1
我有一個住在以下領域的一個項目:的.htaccess重寫多個域
http://www.example.com/PROJECT/
項目中,有三個子頁面,其中有網頁的結構是這樣的:
http://www.example.com/PROJECT/first-subpage.php?Page_ID=12345
http://www.example.com/PROJECT/second-subpage.php?Page_ID=12345
http://www.example.com/PROJECT/third-subpage.php?Page_ID=12345
我試圖爲其中的每一個寫多個Mod重寫規則,以便我可以擁有以下樣式重定向的url,例如:
http://www.example.com/PROJECT/first-section/12345/some-other-text-here
>>
http://www.example.com/PROJECT/first-subpage.php?Page_ID=12345
這裏是我的,但我一直沒能獲得比賽得到回升,根據本.htaccess tester
這裏是我目前的.htaccess
文件:
RewriteEngine On
RewriteBase /PROJECT/
<filesMatch "^(/first-section/.*)">
Options +FollowSymlinks
RewriteRule ^/(.*)$/(.*)$/(.*)$ /first-subpage.php?page_ID=$2
</filesMatch>
<filesMatch "^(/second-section/.*)">
Options +FollowSymlinks
RewriteRule ^/(.*)$/(.*)$/(.*)$ /second-subpage.php?page_ID=$2
</filesMatch>
<filesMatch "^(/third-section/.*)">
Options +FollowSymlinks
RewriteRule ^/(.*)$/(.*)$/(.*)$ /third-subpage.php?page_ID=$2
</filesMatch>
我怎樣才能得到這些規則來正確匹配url?
如果你的htaccess位於/ PROJECT /文件夾中,然後刪除'PROJECT /'(只有'^'後面的那個) – Gerben 2012-02-21 17:21:31
@Gerben正確! – Ashraf 2012-02-21 17:53:14