PHP Real Estate Script Member Forums: Classifieds, FSBO, Agents

Welcome, Guest. Please login or register.

News: PHP REC Member Forums are now live (06/15/08)!
+  PHP Real Estate Script Forums: Classifieds, FSBO, Agents
|-+  Coding
| |-+  General XHTML/HTML/CSS
| | |-+  URL Re-writing
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: URL Re-writing  (Read 1373 times)
benetta
Newbie
*
Posts: 2


View Profile
« on: July 23, 2009, 03:01:22 AM »

Hello

can anybody help me out to for URL re-writing i tried alot but fail to implement it my url is this:

http://www.luxuryhousesusa.com/detail.php?listing=812

I write some code in .htaccess file which is:

RewriteRule ^listing/([0-9]+)$ detail.php?listing=$1


please let me know the right code
Logged
dellison1226
Newbie
*
Posts: 17


View Profile
« Reply #1 on: July 28, 2009, 03:38:08 PM »

This is as far as I was able to get with Mod_Rewrite. The only problem with this is that the rewrite works only if someone types in the url. I need the code in .php to stop outputting dynamic urls. See this link to understand Rewrite Tips


Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^detail-([0-9]+)\.html$ detail.php?listing=$1 [L]

If you type in http://www.yourdomain.com/detail-32.html, mod_rewrite will redirect http://www.yourdomain.com/detail.php?listing=32 with the .html in the url. Even though the link looks like html its actually the php link.

As far as some uses I also used this code. And then changed main links in index.html. For example the link, "buy.php" --- instead of using this link I changed it to "buy-homes". Mod_rewrite then redirects this link to buy.php and shows www.yourdomain.com/buy-homes in the url.

#Rewrite Navigation Links
RewriteRule ^buy-homes/?$ buy.php? [L]

Hope this helps! All I need now is to figure out how to change the output in .php. Here is another useful link for tips and tricks.

David
Logged
Pages: [1] Print 
« previous next »
Jump to: