2017-04-06 148 views
0

好像我不能重寫同一頁的規則與等量的參數。的.htaccess重寫規則衝突的

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule forums/(.*)/(.*).php/(.*)$ forums.php?forums_view_id=$1&forums_view_seo=$2&page=$3 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule forums/(.*)/(.*).php/create$ forums.php?forums_view_id=$1&forums_view_seo=$2&create=true 

只有第一個工作。但是,如果我刪除了第一個,然後第二個作品之一。我怎樣才能解決這個問題?

+0

改變它們的順序。 – hjpotter92

回答

1

您可以使用:

RewriteEngine On 

# skip all files and directories from rewrite rules below 
RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule^- [L] 

RewriteRule forums/(.*)/(.*).php/create$ forums.php?forums_view_id=$1&forums_view_seo=$2&create=true [L] 
RewriteRule forums/(.*)/(.*).php/(.*)$ forums.php?forums_view_id=$1&forums_view_seo=$2&page=$3 [L]