Home  >  Article  >  Backend Development  >  .htaccess文件怎么做301

.htaccess文件怎么做301

WBOY
WBOYOriginal
2016-06-13 10:08:141010browse

.htaccess文件如何做301
我想把这个地址www.bbbb4.com/www.xxx.com.html做301到
www.bbbb4.com/www_xxx_com.html

其中www.xxx.com是一个域名(不固定),有可能有N个点如
www.xxx.xxx.com
www.aaaa.net
www.bbbb.org等等


我的意思就是把域名中的“.”换成“_”

www.bbbb4.com/www.xxx.xxx.com.html就301到
www.bbbb4.com/www_xxx_xxx_com.html

请把代码写出来谢谢。

------解决方案--------------------
同求!
------解决方案--------------------
RewriteEngine On 
RewriteCond %{HTTP_HOST} !^www.bbbb4.com/www.xxx.xxx.com.html$ [NC] 
RewriteRule ^(.*)$ www.bbbb4.com/www_xxx_xxx_com.html/$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