htaccess 使用参数重定向 url 并删除重复项
我有这个网址
http://www.mmametals.com.php5-20.dfw1-1.websitetestlink.com/?page_id=61
,我想重定向到根目录,就像这
http://www.mmametals.com.php5-20.dfw1-1.websitetestlink.com
是我的 htaccess
RewriteEngine on
redirect 301 /?page_id=61/ http://www.mmametals.com.php5-20.dfw1-1.websitetestlink.com
但没有发生任何事情...任何想法
另外我想知道 .htaccess 中是否还有一种方法可以删除重复的 /about ...所以例如,如果 url 是,
http://somesite.com/about/about
它将重写规则以始终为
http://somesite.com/about
I have this url
http://www.mmametals.com.php5-20.dfw1-1.websitetestlink.com/?page_id=61
and i want to redirect to the root like this
http://www.mmametals.com.php5-20.dfw1-1.websitetestlink.com
here is my htaccess
RewriteEngine on
redirect 301 /?page_id=61/ http://www.mmametals.com.php5-20.dfw1-1.websitetestlink.com
but nothing is happening...any ideas
Also I was wondering if there is a way also in .htaccess to delete a duplicate /about ...so for example if the url is
http://somesite.com/about/about
it will rewrite the rule to always be
http://somesite.com/about
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
应该这样做。
should do it.
我不知道确切的答案,因为我不再直接使用 apache 了,但我认为你需要研究一下 apache 的 mod_rewrite 模块。尝试看一下:
I don't know the exact answer off the top of my head as I don't work directly with apache that much any longer, but I think you need to look into apache's mod_rewrite module. Try taking a look at: