Options +SymLinksIfOwnerMatch
IndexIgnore */*
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite.com$ [nc]
Rewriterule ^(.*)$ http://www.mysite.com/$1 [r=301,nc,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . url_handle.php
我想要做的是有一個www重寫規則,以便沒有www的url。使用www重定向到相同的網址。字首。我也使用乾淨的URL,因此任何未知的URL都會發送到url_handle.php進行處理。.htaccess - 重寫網址的一部分
問題是,如果我有像「http://mysite.com/part_1/part_2/part_3」這樣的網址,網址將被重定向,然後讀取「http://www.mysite.com/url_handle.php/part_2/part_3」,省略「part_1」並將其替換爲「url_handle.php」。
你有更多的規則後,或其他htaccess文件?這對我來說可以。 – Prix