【问题标题】:.htaccess rewrite rules are refusing to take effect - any htaccess experts out there?.htaccess 重写规则拒绝生效-那里有任何 htaccess 专家吗?
【发布时间】:2016-12-01 11:07:07
【问题描述】:

我遇到了一个奇怪的问题...... htaccess 规则似乎不起作用

这是我的规则:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^/([^/]+)/([^/]+)/ /index.php?view=$1&layout=$2 [NC]

无论我尝试什么都不会生效。理论上我应该可以访问 /my/test/ 并查看 index.php?view=my&layout=test 的内容

稍后在页面中强制 https:// 的重写规则确实有效,我知道服务器正在读取 htaccess。

服务器是 Centos 6 上的 VPS

有什么想法吗??

【问题讨论】:

    标签: apache .htaccess mod-rewrite url-rewriting centos6


    【解决方案1】:

    这就是答案 - 如果有人来看的话

    规则应为:

    RewriteRule ^([^/]+)/([^/]+)/ /index.php?view=$1&layout=$2 [NC]
    

    (去掉第一个/)

    【讨论】:

      猜你喜欢
      • 2016-05-28
      • 2020-03-08
      • 1970-01-01
      • 2011-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多