MartinW
MartinW

Reputation: 248

Mod-rewrite has revealed itself

I thought that apache mod_rewrite would hide the URL that is being redirected to. i.e. if a user enters http://site.com/iPhone and i've set it up to redirect to http://site.com/search.php?search=iPhone I would have expected that http://site.com/iPhone would still be displayed in the address bar?

.htaccess file is:

<IfModule mod_rewrite.c>
RewriteEngine on 
Options +FollowSymlinks
RewriteBase / 
RewriteRule ^search/(.*) search.php?search=$1 [R]
</IfModule>

Have I got this completely confused?

Upvotes: 3

Views: 178

Answers (1)

Rob
Rob

Reputation: 48369

The [R] modifier causes the response to be redirected to the new URL, rather than handled in-place. Ditch that, and it ought to work (any other problems notwithstanding).

When I'm doing URL rewriting, I like to keep the mod_rewrite cheat sheet from Added Bytes (formerly ILoveJackDaniels) to hand.

Upvotes: 11

Related Questions