I want to be able to rewrite a URL from:
// examples
http://example.com/location/New York, NY -->
http://example.com/location/index.html?location=New York, NY
http://example.com/location/90210 -->
http://example.com/location/index.html?location=90210
http://example.com/location/Texas -->
http://example.com/location/index.html?location=Texas
http://example.com/location/ANYTHING.... -->
http://example.com/location/index.html?location=ANYTHING...
using .htaccess
and mod_rewrite.
Anyone know how to do this?
I have tried:
RewriteEngine on
RewriteCond %{REQUEST_URI} !location/index.html
RewriteRule ^location/(.*)$ /location/index.html?location=$1
However, it is not passing the GET location variable to the /location/index.html page when you use the "pretty url" (e.g. http://example.com/location/90210).
I know this b/c when I echo out to the screen (using javascript) the location GET variable when the long url is used, it's set but when the pretty (short) url is used, the location GET variable is undefined.
Thanks in advance