Reputation: 1
So I have a few different type of URL's that might be experienced: Examples:
So zipcode,school,county,city, neighborhood.
What I am trying to achieve is when one of these URL's is requested, it automatically changes the URL to
.htaccess has been a pain for me, I have tried
RewriteRule ^/search/neighborhood/([A-Za-z0-9-]+)/?$ /search/?doSearch=1&neigborhood=$1 [NC,L]
But I am really not good at this and was seeing if I could get the assistance of someone on here to help write the correct (and stable rewrite).
Upvotes: 0
Views: 22
Reputation: 4302
Try this :
RewriteEngine On
RewriteCond %{QUERY_STRING} doSearch=1&(.*)=(.*)$
RewriteRule "^(search(.+))$" /$1%1/%2/? [L]
Update :
try this :
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/search/(.*)/(.*)/$ [NC]
RewriteRule ^(.*)$ /search?doSearch=1&%1=%2 [L]
The code above means if you request /search/zipcode/42101/
it will be as it and goes internally to original path /search?doSearch=1&zipcode=42101
and so on.
Upvotes: 1