0

我只想重写这个特定的网址:

http://www.website.co.uk/php/project.php?project=anythingHerehttp://www.website.co.uk/php/project/anythingHere

这很好,但是当我去http://www.website.co.uk/php/project/anythingHere 它也改变了所有的链接(样式表,javascript,超链接......我不想改变)。例如:

http://www.website.co.uk/php/index.phphttp://www.website.co.uk/php/project/index.php


这是我已经拥有的

RewriteEngine On
RewriteCond %{HTTP_HOST} ^website.com\.co\.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www\.website.com\.co\.uk$
RewriteRule ^clients$ "http\:\/\/website.com\.co\.uk\/billing\/index\.php" [R=301]
RewriteRule ^project/([^/]*)$ /php/project.php?project=$1
4

1 回答 1

0

你可以试试这个代码:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?website\.co\.uk$ [NC]
RewriteRule ^clients/?$ http://website.co.uk/billing/index.php [NC,L,R=301]

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

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(php/project)/([^/]+)/?$ /$1.php?project=$2 [L,QSA,NC]
于 2013-10-20T16:00:14.593 回答