简单的htaccess RewriteRule不起作用

时间:2014-11-14 17:58:35

标签: regex apache .htaccess mod-rewrite redirect

你好,我有这种格式的网址:http://domain.com/index.php?action=page&name=privacy 想使用htaccess使用domain.com/page/privacy而不是http://domain.com/index.php?action=page&name=privacy。任何想法,请

RewriteRule \/index\.php\/(.*)$ /action/$1

1 个答案:

答案 0 :(得分:1)

您的根目录中需要此规则.htaccess:

RewriteEngine On
RewriteBase /

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