由网友(一盏虔诚)分享简介:目前我的网址是如 http://vidleap.com/nov5and151/index.html 现在我想重定向这个URL如 http://nov5and151.vidleap.com/index.html。因此,如何通过htaccess的做到这一点?我使用跌破code,但它不工作。< IfModule mod...![详解Beyond Compare文件夹同步](https://p.xsw88.cn/allimgs/daicuo/20230902/344.png)
目前我的网址是如 http://vidleap.com/nov5and151/index.html 现在我想重定向这个URL如 http://nov5and151.vidleap.com/index.html。因此,如何通过htaccess的做到这一点?
我使用跌破code,但它不工作。
< IfModule mod_rewrite.c>
< IfModule mod_negotiation.c>
选项-MultiViews
< / IfModule>
RewriteEngine叙述上
的RewriteBase /
的RewriteCond%{} REQUEST_FILENAME!-f
重写规则^的index.php [QSA,L]
的RewriteCond%{HTTP_HOST} ^(?:WWW )?vidleap .COM [NC]
重写规则^([^ /] +)(/.*)$ HTTP://www.$1.vidleap.com$2 [R = 301,L,NC]
的RewriteCond%{HTTP_HOST} ^ WWW 。(。+)。vidleap .COM [NC]
重写规则^(。*)$ / 1%/ $ 1 [L]
< / IfModule>
解决方案
在尝试不同的顺序规则:
< IfModule mod_negotiation.c>
选项-MultiViews
< / IfModule>
RewriteEngine叙述上
的RewriteBase /
的RewriteCond%{} REQUEST_FILENAME -f [OR]
的RewriteCond%{} REQUEST_FILENAME -d
重写规则^ - [L]
的RewriteCond%{HTTP_HOST} ^(?:WWW )?域 .COM [NC]
重写规则^([^ /] +)(/.*)$ HTTP://www.$1.domain.com$2 [R = 301,L]
的RewriteCond%{HTTP_HOST} ^ WWW 。(。+)。域 .COM [NC]
重写规则^(。*)$ / 1%/ $ 1 [L]
重写规则^的index.php [L]
![详解Beyond Compare文件夹同步](https://p.xsw88.cn/allimgs/daicuo/20230902/344.png)
确认清除浏览器缓存。
Currently my URL is like http://vidleap.com/nov5and151/index.html and now I want to redirect this URL like http://nov5and151.vidleap.com/index.html. So how to do it via htaccess?
I am using below code but it's not working.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
RewriteCond %{HTTP_HOST} ^(?:www.)?vidleap.com [NC]
RewriteRule ^([^/]+)(/.*)?$ http://www.$1.vidleap.com$2 [R=301,L,NC]
RewriteCond %{HTTP_HOST} ^www.(.+).vidleap.com [NC]
RewriteRule ^(.*)$ /%1/$1 [L]
</IfModule>
解决方案
Try these rules in different order:
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteCond %{HTTP_HOST} ^(?:www.)?domain.com [NC]
RewriteRule ^([^/]+)(/.*)?$ http://www.$1.domain.com$2 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.(.+).domain.com [NC]
RewriteRule ^(.*)$ /%1/$1 [L]
RewriteRule ^ index.php [L]
Make sure to clear your browser cache.
相关推荐
最新文章