Forum Moderators: phranque
[edited by: engine at 12:58 pm (utc) on Mar 28, 2013]
[edit reason] please use example.com [/edit]
According to you what would be the most efficient way of stripping the query? A redirection or rewriting.
Never use (.*) at the beginning or in the middle of a RegEx pattern. (.*) means "match the rest of the string to the end", and can therefore only be used at the end of a RegEx pattern. Use a more specific match here.
But without using a .* how can I convey that it is a query.
RewriteCond %{QUERY_STRING} ^(.*&)?page= www.example.com/?page=2 is redirected to www.example.com/
I would want to strip both of them. No query should be retained.
example.com/directory/filename.php?a=123&page=456&b=789 RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{QUERY_STRING} ^(.*&)?page=
RewriteRule ^(.*)$ $1?%1 [R=301]