【发布时间】:2014-04-01 18:55:43
【问题描述】:
我正在尝试实现动态
RewriteEngine on
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com$ [NC]
RewriteRule ^/?$ /live/agent/index.php?agent_user_name=%1 [L]
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com$ [NC]
RewriteRule ^(.+?)/?$ /live/agent/$1.php?agent_user_name=%1 [L]
现在这个 .htaccess 转换了
http://mydomain.com/live/agent/index.php?agent_user_name=username 到 http://username.mydomain.com
和
http://mydomain.com/live/agent/forum.php?agent_user_name=username 到 http://username.mydomain.com/form/
但是,还有其他页面我想重定向到子域,例如
http://mydomain.com/live/agent/view_blog.php?agent_user_name=username&blog_id=19 这个页面应该通过子域来阅读,比如http://username.mydomain.com/view_blog/19 等等
http://mydomain.com/live/agent/page.php?agent_user_name=username&content_id=19此页面应由http://username.mydomain.com/content/19等访问
谢谢
【问题讨论】: