Home >Backend Development >PHP Tutorial >求把不带www域名跳到带www域名下的ISAPI Rewrite写法

求把不带www域名跳到带www域名下的ISAPI Rewrite写法

WBOY
WBOYOriginal
2016-06-13 10:32:02893browse

求把不带www域名跳到带www域名上的ISAPI Rewrite写法
我要把http://abc.com/zb/ 跳到http://www.abc.com/zb/上

注意域名后的路径也要带上哦

RewriteCond Host: ^abc\.com(.*)
RewriteRule (.*) http\://www\.abc\.com$1 [I,RP]

我这样写有哪地方不对啊?

------解决方案--------------------

探讨

RewriteEngine on
RewriteCond %{http_host} ^abc.com [NC]
RewriteRule ^(.*)$ http://www.abc.com/$1 [L,R=301]

------解决方案--------------------
探讨

引用:

和目不目录没关系吧
例:

RewriteCond %{HTTP_HOST} ^162100.com [NC]
RewriteRule ^(.*)$ http://www.162100.com/$1 [L,R=301]

你这方法不对
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn