【问题标题】:.htaccess Rewrite mod not working.htaccess 重写 mod 不起作用
【发布时间】:2014-07-11 02:30:24
【问题描述】:

我正在尝试让我的 htaccess 文件使用它:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

重写这个网址:

http://cheesecakebb.org/index.php?action=vn

【问题讨论】:

  • 重写为cheesecakebb.org/index/vn 或类似的东西
  • @user3791747:这是 wordpress 还是您正在使用的其他 PHP/CMS 框架?
  • @anubhava 这是来自 wordpress 的 htaccess,是的

标签: apache .htaccess mod-rewrite


【解决方案1】:

试试这个:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^index/([^/]+)/?$ index.php?action=$1 [QSA,L]

当有人点击example.com/index/something时,它会重定向(对用户不可见)到index.php?action=something

【讨论】:

  • 嗯,使用那个确切的代码它似乎仍然无法正常工作
  • 哦,我明白了,所以实际上我想要它,这样当您转到 example.com/index.php?action=something 时,它会显示为 example.com/index/something
猜你喜欢
  • 2015-10-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多