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]
任何想法如何做到这一点?