2016-09-22 159 views
0

我改變了我的.htaccess來製作漂亮的網址。 這是怎麼回事?RewriteRule .htaccess不能正常工作

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([a-zA-Z0-9-/]+).html$ article.php?url=$1 [NC,L] 
RewriteRule ^([a-zA-Z0-9-/]+).html/$ article.php?url=$1 [NC,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^category/([a-zA-Z0-9-/]+).html$ category.php?cat=$1 [NC,L] 
RewriteRule ^category/([a-zA-Z0-9-/]+).html/$ category.php?cat=$1 [NC,L] 

,我從這個 .htaccess rewriteRule conflict

了我會做出這樣的

localhost/category/bla.html 

localhost/seo/bla.html 

,這是數據庫的URL

bla.html 
seo/bla-bla.html 
+0

什麼網址你試圖實現什麼是原始網址請提及seperatly。 –

+0

謝謝,我已經完成了。 –

回答

1

纔剛剛動底部部分向上

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^category/([a-zA-Z0-9-/]+).html$ category.php?cat=$1 [QSA,L] 
RewriteRule ^category/([a-zA-Z0-9-/]+).html/$ category.php?cat=$1 [QSA,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([a-zA-Z0-9-/]+).html$ article.php?url=$1 [L,QSA] 
RewriteRule ^([a-zA-Z0-9-/]+).html/$ article.php?url=$1 [L,QSA]