【问题标题】:stop requests for index.php+++++++++停止对 index.php+++++++++ 的请求
【发布时间】:2014-01-17 21:33:32
【问题描述】:

我正在尝试重定向请求根 index.php 的用户
我正在使用Redirect 301 /index.php http://mywebsite/junk/index.html
虽然如果人们只请求 index.php,这可以正常工作,
但现在我收到了很多请求 对于 index.php++++(有时 ++ 比其他更多)
有什么我可以添加到Redirect 301 /index.php 以包括重定向 index.php+++ 吗?

【问题讨论】:

    标签: regex apache .htaccess mod-rewrite redirect


    【解决方案1】:

    您可以将mod_rewrite 用于正则表达式功能和更精细的控制:

    RewriteEngine On
    RewriteRule ^index\.php http://mywebsite/junk/index.html [L,R]
    

    【讨论】:

    • 有没有办法在不产生错误 404 的情况下做到这一点?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多