[英]301 Redirect all page and post urls from .html to /
我有一個當前站點,所有URL都以.html結尾。
我創建了一個新站點,URL幾乎相同,但是沒有.html。
我一直在嘗試在我的.htaccess文件中找到的代碼,並且大多數似乎導致內部服務器錯誤。
http://example.com/page1.html to http://example.com/page1/
http://example.com/page1/page2.html to http://example.com/page1/page2/
我當前的htacces文件代碼為:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
您可以安裝Simple 301 Redirect插件,然后嘗試設置如下圖所示的圖像。 剛剛在我的實時網站上進行了測試,它可以完全按照您的要求運行。
還記得您選中了Use wildcards?
復選框。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.