简体   繁体   中英

htaccess rewrite not allowing PHP GET

I have this in my htaccess file:

RewriteCond %{REQUEST_URI} ^/customer/ [OR]
RewriteCond %{HTTP_HOST} ^my\.domain\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.php -f
RewriteRule ^(.*)$ /customer/index.php?p=$1.php [L]

which rewrites things like domain.com/contacts/viewcontact.php to be domain.com/contacts/viewcontact

when i go to the domain

domain.com/contacts/viewcontact?seq=123

and then in PHP echo $_GET["seq"]; it shows nothing.

I have also tried using

domain.com/contacts/viewcontact&seq=123

but this shows page not found

Your RewriteRule resets the query string ( ?p=$1.php ), but doesn't append the existing query string. Add the QSA flag to your rule and it will append the query string from the request to the new one, which should do what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM