Home  >  Article  >  Backend Development  >  .htaccess里做301转向解决思路

.htaccess里做301转向解决思路

WBOY
WBOYOriginal
2016-06-13 13:53:53780browse

.htaccess里做301转向
我现在想把 abc.com转换成www.abc.com
问题是我的.htaccess里面已经做过其它的转向,该怎么写这样
原来是这样的
RewriteEngine On

RewriteBase /  

RewriteCond %{REQUEST_FILENAME} !-f 

RewriteCond %{REQUEST_FILENAME} !-d  

RewriteRule ^(.*)$ /index.php?$1 [L] 

ErrorDocument 404 /index.php

------解决方案--------------------
RewriteCond %{http_host} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{http_host}/$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