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

.htaccess里做301转向解决思路

WBOY
Release: 2016-06-13 10:00:32
Original
834 people have browsed it

.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]

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template