2016-07-31 129 views
-1

情況1和情況2不能一起工作。如果我從.htaccess文件中刪除案例2,案例1將工作。如果我在案例1之前寫入案例2,案例2將不起作用,而案例1將起作用。重寫規則衝突.htaccess

情況1:

RewriteRule /(.*)\.html storycategory.php?story=$1 

實施例:

http://localhost/romoko1/story/bedroom.html 

情況2:

RewriteRule /(.*)\.html tag.php?tag=$1 

實施例:

http://localhost/romoko1/tag/home-interior.html 
+0

試試'story /(.*)。html storycategory.php?story = $ 1'和'tag /(.*)。html tag.php?tag = $ 1'! –

+0

它不工作親愛的... –

+0

Okey!請查看我的新答案! –

回答

0

請在您的.htaccess試試這個:

<IfModule mod_rewrite.c> 

RewriteEngine On 

RewriteBase/

RewriteRule story/(.*).html storycategory.php?story=$1 
RewriteRule tag/(.*).html tag.php?tag=$1 

</IfModule> 

不要忘記啓用rewrite_module

我希望這會幫助你。

+0

#沒有它的子目錄 RewriteBase/romoko1/ –

+0

我在本地主機上工作我必須寫爲 –

+0

http://www.romoko.com/storycategory.php?slug=bedroom –