0

How can I rewrite the following:

http://www.mydomain.com/my-page.html to http://www.mydomain.com/my-page.html?type=1

Tried the following without any luck:

RewriteRule /car-covers.html$ /car-covers.html?type=$1 [R=301,L]

RewriteRule ^car-covers.html$ car-covers.html?type=$1 [QSA,L]

2 Answers 2

1
RewriteRule ^html page/([^/\.]+)?$ index.php?action=search_refine&type=$1 [L]
Sign up to request clarification or add additional context in comments.

Comments

0

With RewriteRule you can only test the URI path but not the query. You need to use RewriteCond to do so, for example:

RewriteCond %{QUERY} !(^|&)type=
RewriteRule ^car-covers\.html$ car-covers.html?type=$1 [QSA,L]

This will add the parameter type to the query and do an internal rewrite. If you want an external redirect, add the R flag.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.