在.htaccess中处理动态子域

在.htaccess中处理动态子域,.htaccess,subdomain,.htaccess,Subdomain,我正在尝试使用.htacess创建自定义域名 这就是我正在做的 http://username.mydomain.com正在访问http://mydomain.com/live/agent/index.php?agent_user_name=username(工作正常) 这是htaccess RewriteEngine on RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com$ [NC] RewriteCond %1 !^www$ [NC] R

我正在尝试使用.htacess创建自定义域名

这就是我正在做的

http://username.mydomain.com
正在访问
http://mydomain.com/live/agent/index.php?agent_user_name=username
(工作正常)

这是htaccess

RewriteEngine on

RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com$ [NC]

RewriteCond %1 !^www$ [NC]

RewriteRule ^$ /live/agent/index.php?agent_user_name=%1 [L]
但现在我想处理其他页面

http://username.mydomain.com/blog
应该访问
http://mydomain.com/live/agent/blog.php?agent_user_name=username


请在.htaccess中帮助处理此问题。您可以使用以下附加规则:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com$ [NC]

RewriteCond %1 !^www$ [NC]

RewriteRule ^$ /live/agent/index.php?agent_user_name=%1 [L]
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]

嗯,它给出了服务器配置错误/内部错误ANUHAVA-这实际上是一个通用的.htaccess。但是如果我必须打开view\u blog.php?agent\u user\u name=11和blog\u id=99,那么在您的新URI
view\u blog.php?agent\u user\u name=11和blog\u id=99中动态子域在哪里?域是相同的,所以agent\u user\u name=username(动态域)由于这似乎是一个与当前问题不同的问题,您能否根据此要求提出一个新问题。