開發與維運

WEB服務的域名301重定向,獨立IP虛擬主機修改.htaccess文件

今天終於把網站的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

Leave a Reply

Your email address will not be published. Required fields are marked *