views:

78

answers:

1

Hi,

my .htaccess in the root folder includes the following lines :

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^(.*)\.htm$ http://example.com/?city=$1 [NC]

when I open the address http://example.com/bla.htm, my browser doesn't hide the GET values specified in the .htaccess, it redirects me to ?city=bla. eventhough I'm not using the [R] switch. This has always worked for me before (as I remember, haven't dealt with htaccess in a while). What's wrong here ?

+2  A: 

When you redirect to an entire URL, it doesn't do URL rewriting (you can't exactly rewrite URLs on someone else's website).

Assuming both URLs are on the same server, you need to do something like

RewriteRule ^(.*)\.htm$ index.php?city=$1 [NC]

Also, I'd recommend getting into the habit of using the [L] switch whenever you can - it helps avoid bugs when you have a lot of URLs to rewrite.

Zarel