0

我一直在寻找这个,但找不到答案。我可能在这里错过了一些东西。基本上我在一个 CI 安装下有两个应用程序。每个应用程序都有自己的子域。例如http://foo.example.com/,哪个将重定向到http://example.com/foohttp://bar.example.com/哪个将重定向到http://example.com/bar. 它http://example.com/本身将是某种登陆页面。

重定向部分工作正常。但它不断将 URL 从 更改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

非常感谢您的回复。

4

0 回答 0