我有Windows和Linux服务器。(在Linux服务器中的域管理)。
需要重定向到
我需要所有到http://test.mydomain.com的请求,将其重定向到http://192.97.XX.XX/Hello
在这里,我尝试使用htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.test.mydomain\.com$
RewriteRule ^/?$ "http\:\/\/192.97.XX.XX\Hello \/"发布于 2014-03-13 12:43:34
这将失败,因为您告诉htaccess查找www.test.mydomain.com,除此之外,您不会在test之前转义.
如果你改成这样,你应该没问题。
RewriteEngine on
RewriteCond %{HTTP_HOST} ^test\.mydomain\.com$
RewriteRule ^(.*)$ http://192.97.XX.XX/Hello [R=301,L]现在是这样说的:
^的意思) test.mydomain.comNB我也对最后一行做了相当大的改动
发布于 2014-03-13 12:43:37
您可以在测试域的文档根目录中使用此规则:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?test\.mydomain\.com$ [NC]
RewriteRule ^(.*)$ http://192.97.XX.XX/Hello/$1 [L,R]https://stackoverflow.com/questions/22369141
复制相似问题