为什么重写模块在.htaccess中不起作用

时间:2018-10-09 18:07:25

标签: mod-rewrite

我正在尝试获取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://ex.com/index.php?do=some

1 个答案:

答案 0 :(得分: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

好吗?