.htaccess 我的htaccess子域重写有什么问题?

.htaccess 我的htaccess子域重写有什么问题?,.htaccess,.htaccess,我想将www.domain.com/s/index.php?s=test重写为test.domain.com 我使用以下方法在本地主机上成功地实现了这一点 RewriteCond %{HTTP_HOST} ^([^\.]+)\.localhost$ [NC] RewriteRule ^$ /s/index.php?s=%1 [L] 然而,当我把它放在我的服务器上时,它没有工作。下面是代码 RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC]

我想将www.domain.com/s/index.php?s=test重写为test.domain.com

我使用以下方法在本地主机上成功地实现了这一点

RewriteCond %{HTTP_HOST} ^([^\.]+)\.localhost$ [NC]
RewriteRule ^$ /s/index.php?s=%1 [L]
然而,当我把它放在我的服务器上时,它没有工作。下面是代码

RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC]
RewriteRule ^$ /s/index.php?s=%1 [L]

出了什么问题?感谢您的建议。

经过仔细研究,我发布的上述htaccess代码没有错误。出现错误是因为存在冲突语句。

经过彻底研究,我发布的上述htaccess代码中没有错误。出现错误是因为存在冲突语句。

您得到了什么错误(如果您得到了错误)?没有错误,当我转到test.domain.com时,它只显示domain.com,当它应该显示来自www.domain.com/s/index.php?s=test的内容时,您得到了什么错误(如果您得到了错误)?没有错误,当我转到test.domain.com时,它只显示domain.com,而它应该显示来自www.domain.com/s/index.php?s=test的内容