[英]How redirect subdomain to folder
i want to redirect subdomain to folder, here on SO are some examples so i tried them but nothing works, now i got this: 我想将子域重定向到文件夹,在这里有一些示例,所以我尝试了它们,但没有任何效果,现在我得到了:
RewriteEngine on
RewriteCond %{HTTP_HOST} http://test.web8.eu [NC]
RewriteRule ^(.*)$ "http://web8.eu/sub/test/$1" [L,P]
can anyone help me with this? 谁能帮我这个?
Can i rewrite subdomain to folder instead redirecting?? 我可以将子域重写为文件夹而不是重定向吗?
Do it like this: 像这样做:
RewriteEngine on
RewriteCond %{HTTP_HOST} test\.web8\.eu [NC]
RewriteRule ^ http://web8.eu/sub{REQUEST_URI} [NE,L,R]
Try adding this to the .htaccess
file in your web document root folder (often public_html
or htdocs
): This assumes that mod_rewrite is both installed and activated for htaccess files. 尝试添加该到
.htaccess
在Web文档根目录文件夹文件(通常public_html
或htdocs
):这是假设mod_rewrite并同时安装和 htaccess的文件被激活。 If you are not sure, to check if mod_rewrite is installed, look at the list of installed modules in the output of phpinfo();
如果不确定,要检查是否安装了mod_rewrite,请查看
phpinfo();
输出中已安装模块的列表phpinfo();
By default, mod_rewrite is not enabled for htaccess files. 默认情况下,htaccess文件未启用mod_rewrite。 If you are managing your own server, open
httpd.conf
and make sure that the webroot directory block contains one of these lines: AllowOverride FileInfo
or AllowOverride All
如果要管理自己的服务器,请打开
httpd.conf
并确保webroot目录块包含以下行之一: AllowOverride FileInfo
或AllowOverride All
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.