Problem with rewrite

Discuss practical ways rearrange URLs using mod_rewrite.

Problem with rewrite

Postby solaz » Fri Sep 05, 2008 8:52 am


Please help before I go crazy :-?

I can get either:

to redirect correctly, but as soon as I try to put both lines into the htaccess the line that previously worked in isolation won't work.

I have done similar countless times before, and have spent a lot of time making sure I'm not being stupid, but it seems like something else is wrong here.

RewriteEngine On
RewriteRule ^properties/([A-Za-z0-9-]+)$ search.php?country=$1 [L]
RewriteRule ^properties/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)$ search.php?country=$1&county=$2 [L]

Can anyone see what the problem is?
Posts: 3
Joined: Mon Nov 12, 2007 3:06 pm

Postby richardk » Fri Sep 05, 2008 9:05 am

What happens? A 404 error?
Where are you putting the mod_rewrite?
Where is search.php?
Do you have any other mod_rewrite?
Do you have a file called properties.something?

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^properties/([-a-zA-Z0-9]+)/?$                 /search.php?country=$1           [QSA,L]
RewriteRule ^properties/([-a-zA-Z0-9]+)/([-a-zA-Z0-9]+)/?$ /search.php?country=$1&county=$2 [QSA,L]
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 6 guests