【问题标题】:My redirect in .htaccess isn't working我在 .htaccess 中的重定向不起作用
【发布时间】:2012-03-20 10:07:32
【问题描述】:

我在我的 public_html 文件夹中使用 .htaccess 将我的文件夹重定向到gets:

RewriteCond %{REQUEST_FILENAME} !-f

重写规则 ^([^/])/?([^/])/?$ index.php?v=$1&t=$2

当我键入我的页面时,它给了我一个 404 错误:

http://southeast.tv/1/e

但它应该重定向到:

http://southeast.tv/index.php?v=1&t=e

【问题讨论】:

    标签: .htaccess redirect


    【解决方案1】:

    确保您拥有所有这些行:

    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/])/?([^/])/?$ index.php?v=$1&t=$2
    

    【讨论】:

    • 好的,现在它进入了我的 codeigniter,我得到了一个 codeigniter 404,所以它一定会以某种方式访问​​ index.php。
    【解决方案2】:
    RewriteRule ^([^/]+)(\/)?([^/]+)? index.php?v=$1&t=$3
    

    【讨论】:

    • 尝试在 index.php 之前添加根目录(如 http://.../)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-07
    • 2015-08-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多