1
好了,所以我有這個.htaccess文件,並獲取基礎用$ 1後的第一個目錄和第二,用$ 2重寫規則對URL的最後兩個參數取
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 ^[^\.]+[^/]$
RewriteRule (.*) http://%{HTTP_HOST}/$1/ [R=301,L]
RewriteRule ^([^/]+)/([^/]+)/$ index.php?sub=$1&page=$2 [L]
RewriteRule ^([^/]+)/$ index.php?sub=$1&page=$1 [L]
#RewriteRule ^(.*)/(.*)$ index.php?sub=$1&page=$2 [L]
#RewriteRule ^(.*)$ index.php?sub=$1&page=$1 [L]
</IfModule>
現在,我們需要測試在這個網站生產服務器在一個子目錄中。這將增加額外的目錄URL
這樣: hxxp://本地主機/ newwebsite/VAR1/VAR2/
有沒有辦法只能獲取一個URL的最後兩個參數,或者我應該只是推力它會以我們想要的方式工作。 (不是真正的選擇)
謝謝!
所以給出的'.htaccess'文件就是你已經擁有的,你想知道如何添加另一個規則來捕獲'newwebsite'目錄中的某些東西? – JRSofty