好了,所以我有这样的URL,这些demo1.domain,demo2.domain,demo3.domain和所有需要显示的子文件夹的内容,这样的例子 demo1.domain将显示domain/websites/demo1的内容 我需要做的是在所有的领域,比如$ whatever.domain到domain/websites/$whatever.domain,我已经启用了DNS通配符的方式,而我似乎无法fiqure出来,请大家多记住我不希望它重定向。
Ok so i have urls like these demo1.domain, demo2.domain, demo3.domain and all needs to show the contents of a subfolder like this example demo1.domain will show the contents of domain/websites/demo1 i need to do it in a way that all the domains like $whatever.domain into domain/websites/$whatever.domain, i already enabled wildcard dns, and i cant seem to fiqure it out, please keep in mind i dont want it to redirect.
下面是我试过
RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^(www\.)?[^.]+\.domain\.*$ RewriteRule /websites/$1 [L]
我刚刚得到domain的主页与此有关。
I just get the main page of domain with this.
您的帮助将大大AP preciated。
Your help will be greatly appreciated.
推荐答案关闭,试试这个:
RewriteEngine on RewriteBase / RewriteCond %{REQUEST_URI} !^/websites/ RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+\.domain\.*)$ [NC] RewriteRule ^(.*)$ /websites/%2/$1 [L]请注意,这只会工作,如果所有的演示* .domain 指向同一个文档根目录作为主域( domain )
Note that this will only work if the all the demo*.domain point to the same document root as the main domain (domain).
更多推荐
的.htaccess重写多个URL重定向没有
发布评论