CodeIgniter htaccess用于子域而不更改URL

时间:2013-11-02 06:52:20

标签: apache .htaccess codeigniter

我一直在搜索这个,但找不到答案。我可能在这里错过了什么。基本上我在一个CI安装下有两个应用程序。每个应用都有自己的子域名。例如,http://foo.example.com/将重定向到http://example.com/foohttp://bar.example.com/,重定向到http://example.com/barhttp://example.com/本身就是某种着陆页。

重定向部分工作正常。但它会不断更改从http://foo.example.com/http://example.com/foo的网址,我希望将其阻止。我已经阅读了使用[P]而不是[L]标志的解决方案,但这需要我启用代理。

除了启用代理之外,我还有其他选择吗?

目前我的htaccess文件如下:

RewriteEngine On
RewriteBase /

#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]

# The line for subdomain
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com
RewriteRule ^(.*)$ http://example.com/%1/$1 [L,NC,QSA]

# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

ErrorDocument 404 /index.php

非常感谢您的回复。

0 个答案:

没有答案