0
我有一個域test.com
和一個子域sub.test.com
。使用.htaccess重寫所有子域URL
現在,我需要的URL sub.test.com
到test.com/?state=sub
,像sub.test.com/content/
到test.com/content/?state=sub
的URL,並sub.test.com/content/proceed/
改寫爲test.com/content/proceed/?state=sub
。
第一個URL規則的工作,這樣的事情:
RewriteCond %{HTTP_HOST} !^www\.test\.com
RewriteCond %{HTTP_HOST} !^webmail\.test\.com
RewriteCond %{HTTP_HOST} !^m\.test\.com
RewriteCond %{HTTP_HOST} ([^.]+)\.test\.com
RewriteCond %{REQUEST_URI} !^/index\.php$
RewriteCond %{REQUEST_URI} !robots.txt.*
RewriteRule ^$ http://www.test.com/?state=%1 [P]
任何想法如何做到這一點?