Reputation: 1
I am trying to redirect a subfolder to an upper level subfolder and remove the query string
Source URL: mysite.com/blog/folder/?start=20
Destination URL: mysite.com/blog/
When I use
RedirectMatch 301 ^/blog/folder/(.*)$ http://mysite.com/blog/?
It goes to mysite.com/blog/?
When I use
RedirectMatch 301 ^/blog/folder/(.*)$ http://mysite.com/blog/
It goes to mysite.com/blog/?start=20
Is there a way to completely strip the query string including the question mark?
Upvotes: 0
Views: 455
Reputation: 9539
try adding the following to your .htaccess file
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/blog/folder/ [NC]
#the ?at the end will remove the querystring
RewriteRule . http://mysite.com/blog/? [L,R=301]
Upvotes: 1