在codeigniter中使用符号链接之前的控制器/方法

时间:2013-12-21 09:46:36

标签: php .htaccess codeigniter symlink

我只是需要一些帮助,我认为是时候问一些好的felas了解帮助。 这是我的情况,我一直在尝试使用符号链接伪造我的网址。

www.website.com/uk/controllers/method/etc
www.website.com/us/controllers/method/etc

aparently codeigniter failes读取控制器。 uk和us段是根目录的符号链接,所以我希望它应该指向root。什么使我确信它指向根是通过查看www.website.com/uk/它工作正常没有错误一切都很好。请帮我解决这个问题。它可能是我在htaccess或路径文件中丢失的东西。我一直对此感到头疼。

这是我目前的htaccess内容

Options FollowSymLinks


RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{THE_REQUEST} /index\.(php|html)
RewriteRule (.*)index\.(php|html)(.*)$ $1$3 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

2 个答案:

答案 0 :(得分:0)

我不确定这是否会有所帮助,但如果您使用的是语言课程,请查看此扩展: https://github.com/EllisLab/CodeIgniter/wiki/URI-Language-Identifier

答案 1 :(得分:0)

尝试使用此代码将/us//uk/重定向到root:

选项FollowSymLinks

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{THE_REQUEST} /index\.(php|html)
RewriteRule (.*)index\.(php|html)(.*)$ $1$3 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]

RewriteCond %{REQUEST_URI} ^(system|application)
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteRule ^(?:us|uk)/(.*)$ /$1 [L,NC,R]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]