1
以外的子域我試圖重定向到一個子域的所有流量。國防部重寫 - 重定向到除某些URL(codeigniter)
www.example.com,example.com,sub.othersite.com 全部重寫sub.othersite.com
它的偉大工程。現在我需要排除一個URL重定向到子域
因此,如果www.example.com/THE/URI進來,我想mod重寫忽略子域重寫並將其發送到主域。
似乎很簡單,但我無法得到它的工作,因爲我有一個額外的重寫,確保所有域(有幾個停放的)以及漏斗到一個單一的域來傳遞內容。
我有一些其他的重寫條件。他們都列在這裏。如果有人能在正確的方向指向我 - 我需要基本上做到這一點:
如果傳入的請求是/的/ URI 然後去www.example.com/THE/URI 否則 重寫子。 othersite.com
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
# ignore system folder
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(client/*)
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
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php?/$1 [L]
# if it is the SPECIAL URI redirect and EXIT
RewriteCond $1 !^(/THE/URI)
RewriteCond %{HTTP_HOST} !^www.example.com$
RewriteRule ^(.*)$ http://www.example.com/THE/URI [L]
#catch all other traffic
RewriteCond %{HTTP_HOST} !^example.anothersite.com$
RewriteRule ^(.*)$ http://example.anothersite.us/$1
</IfModule>