0
我在下面的工作幾乎完美的htaccess規則。當我加載htaccess重定向問題與/
http://localhost:8888/site/name/register/它按照預期重定向到http://localhost:8888/site/name/fr/register/。
但是,當我加載http://localhost:8888/site/name/register(無尾斜槓)重定向不會發生。我確信我只需要在.htaccess規則的某個地方添加一個斜線,但無法找到在哪裏(將它添加到RewriteBase中沒有任何區別)。
RewriteEngine On
RewriteBase /site/name/
#some URI processing also occurs in routing.php!
RewriteCond $1 !^(fr|nl)$
#don't apply the rule to the assets folders
RewriteCond $1 !^css$
RewriteCond $1 !^js$
RewriteRule ^([^/]+)/.* /site/name/fr/$0 [L,R=301]
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
注意該網站主頁是http://localhost:8888/site/name
我怎樣才能也發生在http://localhost:8888/site/name/register重定向?
嗯不,我得到了「網頁沒有正確重定向」的網址的有和沒有斜槓。 – stef 2010-03-09 15:58:24
你是什麼意思?像一個例外? – Alxandr 2010-03-09 23:23:04