How to redirect dynamic urls to their relevant sta

2019-07-24 16:48发布

Dynamic urls are like

example.com/wp/?2323e=467467
example.com/any-page.html?2323e=567856
example.com/any-folder/other-page.html?2323e=6435346

I want to redirect them all to their static urls like

example.com/wp/
example.com/any-page.html
example.com/any-folder/other-page.html

please suggest how to do this using 301 redirect

1条回答
贼婆χ
2楼-- · 2019-07-24 17:26

To remove query strings, you can use :

RewriteEngine on


RewriteCond %{QUERY_STRING} .+ [NC]
RewriteRule ^ %{REQUEST_URI}? [L,R]

This will redirect :

/foo?querystring

to

/foo
查看更多
登录 后发表回答