2013-11-21 30 views
2

我有两个细节页面国防部重写块up参数。1多个PHP页面

为detail.php以下的.htaccess作品:

options -multiviews 
RewriteEngine On 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+detail\.php\?kfld=([^\s&]+) [NC] 
RewriteRule^/%1.html? [R=301,L] 
RewriteRule ^([^.]+)\.html$ /detail.php?kfld=$1 [L,NC,QSA] 

我要的是:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/(*)etail\.php\?kfld=([^\s&]+) [NC] 
RewriteRule^/%1.html? [R=301,L] 
RewriteRule ^([^.]+)\.html$ /$1etail.php?kfld=$2 [L,NC,QSA] 

这可能在.htaccess?

行!这个是什么:

if foreclosures 
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+detail\.php\?kfld=([^\s&]+) [NC] 
    RewriteRule^/%1.html? [R=301,L] 
    RewriteRule ^([^.]+)\.html$ /detail.php?kfld=$1 [L,NC,QSA] 
else 
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+LandContractsDetail\.php\?kfld=([^\s&]+) [NC] 
    RewriteRule^/%1.html? [R=301,L] 
    RewriteRule ^([^.]+)\.html$ /LandContractsDetail.php?kfld=$1 [L,NC,QSA] 
endif 

回答

2

考虑以下代码:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/LandContractsDetail\.php\?kfld=([^\s&]+) [NC] 
RewriteRule^/landcontracts/%1.html? [R=301,L] 

RewriteRule ^landcontracts/([^.]+)\.html$ /LandContractsDetail.php?kfld=$1 [L,NC,QSA] 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/detail\.php\?kfld=([^\s&]+) [NC] 
RewriteRule^/foreclosures/%1.html? [R=301,L] 

RewriteRule ^foreclosures/([^.]+)\.html$ /detail.php?kfld=$1 [L,NC,QSA] 
+0

尝试过的代码,但得到了下面的出错输出... http://www.mymichiganforeclosures.com/detail-2154-Crystal-Cove -Dr-Allegan-MI-49010.html –

+0

当我点击它时,我没有得到任何错误? – anubhava

+0

这是它应该做的:http://www.mymichiganforeclosures.com/2154-Crystal-Cove-Dr-Allegan-MI-49010.html但是,它会去索引页... –