htaccess重写规则在第一次出现时停止

时间:2016-08-06 14:11:48

标签: php apache .htaccess mod-rewrite

我有一个htaccess文件来匹配所有出现的事件。但它停在第二个。当我加载/ galeri / kategori / galeri-kategory-albumname /它加载sayfa.php,它与画廊页面本身没有关系。它在我的localhost上工作正常,但试图找出它在服务器中不起作用的原因。

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)$ index.php?p=$1 [L]
RewriteRule ^(.*?)\/sayfa(.*?)$ index.php?p=$1&sayfa=$2 [L]
RewriteRule ^(.*?)\/kategori\/(.*?)\/$ index.php?p=$1&kategori=$2 [L]
RewriteRule ^(.*?)\/kategori\/(.*?)\/(.*?)\/$ index.php?p=$1&kategori=$2&sayfa=$3 [L}

1 个答案:

答案 0 :(得分:2)

这样做:

Options +FollowSymLinks -MultiViews
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^(.*)/kategori/(.*)/(.*)/?$ index.php?p=$1&kategori=$2&sayfa=$3 [L,QSA]

RewriteRule ^(.*)/kategori/(.*?)/?$ index.php?p=$1&kategori=$2 [L,QSA]

RewriteRule ^(.*)/sayfa(.*?)/?$ index.php?p=$1&sayfa=$2 [L,QSA]

RewriteRule ^(.*)$ index.php?p=$1 [L,QSA]