现在有时我在我的 htaccess 周围,没有办法得到我想要的东西......
我想重写如下:
http://www.mydomain.com/trunk/public/lang/ => http://www.mydomain.com/trunk/public/?l=lang
http://www.mydomain.com/trunk/public/lang/profile => http://www.mydomain.com/trunk/public/profile?l=lang
http://www.mydomain.com/trunk/public/lang/user/45 => http://www.mydomain.com/trunk/public/user/45?l=lang
...
知道怎么做吗?
- - - - 编辑 - - - -
我的 htaccess 实际上看起来像:
<IfModule mod_rewrite.c>
RewriteEngine On
#Transform lang into get parameter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(fr|en)/$ ?l=$1 [L,QSA]
#Transform lang into get parameter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(fr|en)/(.+)$ $1?l=$2 [L,QSA]
#This last condition enables access to the images and css folders, and the robots.txt file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|public|images|assets|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
结果 :
http://www.mydomain.com/trunk/public/lang/ gives a bonfire 404 error (it tries to load "lang" module)
http://www.mydomain.com/trunk/public/lang/profile gives a server 404 error
http://www.mydomain.com/trunk/public/profile works
http://www.mydomain.com/trunk/public/profile?l=fr works
我已经设法通过放置在主干父目录中的 htaccess 在主干/公共文件夹中设置默认域目标