Showing results for 
Search instead for 
Did you mean: 

Custom Friendly URLs problem

Custom Friendly URLs problem



I am trying to create a mod_rewrite rule that will handle transparently rewriting a friendly URL to a query string redirect behind the browser.


Every  tutorial says to use the 'last' flag [L]

but this does not work, per se. or it seems not to.

The original URL that works looks like this



my friendly URL looks like this 



my rewrite rule looks like this

RewriteCond %{THE_REQUEST} ^GET\ /locations/
RewriteRule ^locations/(.*)/(.*)$ /locations?state=$1&city=$2 [L]

I get a 404 error when I try to his my friendly URL

however, if I add the 'redirect' flag [R]

RewriteCond %{THE_REQUEST} ^GET\ /locations/
RewriteRule ^locations/(.*)/(.*)$ /locations?state=$1&city=$2 [R, L]

The URL redirects  and  the page loads, however the address bart gets updated to read 


Why does the redirect work but the non-redirect not?
is it because it's too late for Apache to consume the rewritten URL and re-parse it to the actual final URL?

How might I get around this?