Mod-rewrite showed himself

I thought apache mod_rewrite would hide the URL it redirects to. that is, if the user enters http://site.com/iPhone and I configured it to redirect to http://site.com/search.php?search=iPhone I would expect http://site.com/ Will the iPhone still display in the address bar?

File

.htaccess:

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

Am I completely embarrassed?

+3
source share
1 answer

The modifier [R]forces you to redirect the response to a new URL, rather than being processed in-place. Drop it and it should work (despite any other problems).

URL-, mod_rewrite - ( ILoveJackDaniels).

+11

Source: https://habr.com/ru/post/1703853/


All Articles