【问题标题】:URL rewriting not working correctlyURL 重写无法正常工作
【发布时间】:2012-05-07 11:49:47
【问题描述】:

我正在创建一个网站,但我不明白为什么 mod_rewrite 不起作用。

这里是当前网址:http://www.treetle.com/profile/index/show/rameshmantha
并希望将其重写为http://www.treetle.com/profile/rameshmantha

rameshmantha 是配置文件名称(动态出现) 这是我的 .htaccess 文件。

RewriteEngine on

Options +FollowSymLinks

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1

RewriteRule ^/profile/([a-z]+)?$ /profile/index/show/$1[L,QSA]

【问题讨论】:

    标签: apache mod-rewrite ubuntu


    【解决方案1】:

    RewriteRule ^(.*)$ index.php/$1 匹配所有内容。您是否尝试过将订单换成:

    RewriteRule ^/profile/([a-z]+)?$ /profile/index/show/$1[L,QSA]
    RewriteRule ^(.*)$ index.php/$1
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-13
      • 1970-01-01
      • 1970-01-01
      • 2011-05-15
      • 2019-04-15
      • 2014-08-25
      • 1970-01-01
      • 2016-02-28
      相关资源
      最近更新 更多