user2710234
user2710234

Reputation: 3235

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

Upvotes: 0

Views: 39

Answers (1)

Andrew Schulman
Andrew Schulman

Reputation: 3554

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.

Upvotes: 2

Related Questions