I'm trying to pass parameters and use the GET
function in PHP on a URL that has already been rewritten using mod rewrite.
I have this in my HTACCESS file:
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^-]*)/$ ?action=$1 [L]
RewriteRule ^search/$ ?action=search [L]
If I have a URL like http://www.example.com/search/?q=test
I'm unable to get any of the parameters which I suspect is due to me already rewriting the URL!?
I've tried using the QSA
flag like below but still haven't been able to get it working.
RewriteRule ^search/?$ ?action=search [L,QSA]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…