天天看点

WEB服务的域名301重定向,独立IP虚拟主机修改.htaccess文件BEGIN WordPressEND WordPress

今天终于把网站的URL 301重定向做好了。真是费尽波折啊。

网站为

https://www.mobangwang.com/ 原本URL格式为 https://www.mobangwang.com/a/b/ 先301到 https://www.mobangwang.com/a/b.html 最后经过配置 .htaccess 文件成功重定向,格式如下:

BEGIN WordPress

< IfModule mod_rewrite.c >

RewriteEngine On

RewriteBase /

RewriteRule ^ index .php$ - [L]

RewriteRule ^ (. ) / (. ) / $ $ 1 / $ 2 .html [R = 301 ,L]

RewriteCond %{REQUEST_FILENAME} ! - f

RewriteCond %{REQUEST_FILENAME} ! - d

RewriteRule . / index.php [L]

IfModule >

END WordPress