开发者

Remove slugs and redirect using htaccess

开发者 https://www.devze.com 2023-03-19 10:35 出处:网络
Using .htaccess, how can I strip parameters from a url and redirect an entire folder to another location?

Using .htaccess, how can I strip parameters from a url and redirect an entire folder to another location?

For example, I have http://www.webbiscuit.co.uk/News.aspx/11/favicon-competition and I just want to redirect this to http://www.webb开发者_如何学Goiscuit.co.uk/.

I have tried

Redirect 301 /News.aspx http://www.webbiscuit.co.uk/

but that just strips off the News.aspx part, and redirects me to

http://www.webbiscuit.co.uk/11/favicon-competition

How can I strip off the entire file and the slugs?


Using mod_rewrite (the ? may be unnecessary here):

RewriteRule ^News\.aspx(.*) http://www.webbiscuit.co.uk/? [NC,R=301,L]
0

精彩评论

暂无评论...
验证码 换一张
取 消