我正在嘗試像這樣批量重定向我的站點鏈接,我需要從每個鏈接中洗掉 home 并將其重定向到根目錄,如下所示。
example.com/home/hello-world.
example.com/home/tag/world.
到
example.com/hello-world
example.com/tag/world.
我正在使用這些代碼
RewriteEngine On
RewriteCond %{REQUEST_URI} (. )/home(.*)$
RewriteRule ^ %1/ [R=301,L]
uj5u.com熱心網友回復:
考慮到您的 htaccess 規則檔案除了顯示的規則之外還有更多規則,這些規則將負責處理后端頁面(重寫),如果是這種情況,請嘗試遵循 htaccess 規則檔案。
請將這些規則放在您的 htaccess 規則檔案的頂部。還要確保在測驗 URL 之前清除瀏覽器快取。
RewriteEngine ON
RewriteBase /example.com/
RewriteRule ^home/(.*)$ /$1 [R=301,L]
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/403321.html
標籤:
上一篇:FlutterWeb404未找到
