Reputation: 309
RewriteRule new/$ /search.php?category=1
RewriteRule new/\?(.+)$ /search.php?category=1&$1
I'm trying to do something like this, if the following address link is accessed,
http://onlineshop.com/new/
http://onlineshop.com/new/?price_max=30
then it will open this link,
http://onlineshop.com/new/search.php?category=1
http://onlineshop.com/new/search.php?category=1&price_max=30
Unfortunately it is not working this way.
Upvotes: 0
Views: 110
Reputation: 784958
You can just simply redirect from /new
to /search.php
with QSA flag and Apache will append the existing query string. Something like this will work for you:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^new/?$ /search.php?category=1 [L,QSA,NC]
Upvotes: 0
Reputation: 68790
A RewriteRule
won't naturally catch query string parameters, you must use this kind of .htaccess
:
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^new/$ /search.php?category=1&%1
Upvotes: 1