2015-12-09 82 views
0

我聯繫:不同名稱的.htaccess修改文件

mydomain.com/index.php 
mydomain.com/index.php?cat=1 
mydomain.com/index.php?product=1 
mydomain.com/index.php?view=content 
mydomain.com/pages.php?view=order 
mydomain.com/pages.php?view=register 
mydomain.com/price.php 

當我進入這個瀏覽器鏈接,必須從文件中獲取內容:

index.php.html 
index.php_cat=1.html 
index.php_product=1.html 
index.php_view=content.html 
pages.php_view=order.html 
pages.php_view=register.html 
price.php.html 

如何修改.htacces文件所有這些鏈接?

回答

0

試試這個:

#RewriteCond %{REQUEST_FILENAME} !-d 
#RewriteCond %{REQUEST_FILENAME}\.php -f 
#RewriteRule ^(.*)$ $1.php 
RewriteEngine on 
# general 
RewriteRule ^index.php.html$ index.php 
RewriteRule ^pages.php_view=register.html$ pages.php?view=register 
0

嘗試:

RewriteEngine on 
RewriteRule ^index.php\.html$ /index.php [NC,L] 
RewriteRule ^price\.php\.html$ /price.php [NC,L] 
RewriteRule ^([^.]+)\.php_([^=]+)=([^.]+)\.html$ /$1.php?$2=$3 [NC,L]