.htaccess更改链接点击的文件名

时间:2014-09-01 14:27:30

标签: .htaccess

这不起作用,这应该是容易的部分

 RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
 RewriteRule ^ %1 [R,L]
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME}.php -f
 RewriteRule ^(.*?)/?$ $1.php [L]
 RewriteCond %{THE_REQUEST} /rent\.php 
 #RewriteRule . RentCar/ [R=301,L]
 RewriteRule ^RentCar/$ rent.php[L]
 RewriteCond %{THE_REQUEST} /rent 
 RewriteRule ^RentCar/$ rent[L]

虽然在此代码工作之前有更复杂的部分

  RewriteCond %{THE_REQUEST} /rent2\.php\?r=([^&\s]+)\s [NC]
  RewriteRule . CarRental/%1/? [R=301,L]

  RewriteCond %{THE_REQUEST} /rent2\.php\?r=([^&\s]+)&w=([^&\s]+)\s [NC]
  RewriteRule . CarRental/%1/%2/? [R=301,L]

  RewriteRule ^CarRental/([^/]+)/$ rent2.php?r=$1 [L]
  RewriteRule ^CarRental/([^/]+)/([^/]+)/$ rent2.php?r=$1&w=$2 [L]

1 个答案:

答案 0 :(得分:0)

经过一番关注后,它得到了解决:

RewriteCond%{THE_REQUEST} /rent.php \ _ [NC]    重写规则。 RentACar / [R = 301,L]

RewriteRule ^ RentACar / $ rent.php [L]

正在工作

http://www.lebmotors.com/new/RentACar/