Htaccess rewriterule $ 1给出index.php而不是参数

时间:2012-11-15 11:36:15

标签: .htaccess mod-rewrite

我正在尝试让最后一个重写器在php中获得“lang”。但是,当我打开参数时,它返回“index.php”。以下代码有什么问题?

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)/(.*) index.php?lang=$1&url=$2 [NC]
RewriteRule ^([^/]+)/home/([^/]+)/?$ index.php?lang=$1&voorpagina=$2 [NC]

1 个答案:

答案 0 :(得分:1)

尝试添加[L]标志,如下所示:

Options +FollowSymlinks
RewriteEngine on

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

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*) index.php?lang=$1&url=$2 [NC,L]