2014-01-20 166 views
0

我创建一个htaccess我要重新命名所有的扩展PHP文件,为.html 我把创建SEO友好的URL不工作(的.htaccess)

Options +FollowSymLinks 
RewriteEngine On 
RewriteBase/
RewriteCond %{THE_REQUEST} (.*)\.php 
RewriteRule ^(.*)\.php $1.html [R=301,L] 
RewriteCond %{THE_REQUEST} (.*)\.html 
RewriteRule ^(.*)\.html $1.php [L] 

,它做工精细。 现在我想重新命名NETTOYAGE细节,bureaux.php?ID = 21 NETTOYAGE细节-局-21.html ,所以我加

RewriteRule ^nettoyage-detail-bureaux-([0-9]+)\.html$ nettoyage-detail-bureaux.html?id=$1 [L] 

这是行不通的。 有什么想法?

回答

0

我想你可能会在最后一个错字,你有.html?id=$1应该是.php?id=$1

那么试试这个。

Options +FollowSymLinks 
RewriteEngine On 
RewriteBase/
RewriteRule ^nettoyage-detail-bureaux-([0-9]+)\.html$ nettoyage-detail-bureaux.php?id=$1 [L] 
RewriteCond %{THE_REQUEST} (.*)\.php 
RewriteRule ^(.*)\.php $1.html [R=301,L] 
RewriteCond %{THE_REQUEST} (.*)\.html 
RewriteRule ^(.*)\.html $1.php [L] 
+0

不幸的是,它不工作:( –