我有幾個想要重定向的不需要的網址:
/faq/
/faq/question/1-title
/faq/question/2-title
我希望所有 /faq/question/* url 重定向到 /faq,這可能嗎?
我有這個,但這不起作用:
RedirectMatch 301 ^/faq/question/([^/] )/?$ /faq
uj5u.com熱心網友回復:
使用您顯示的示例/嘗試,請嘗試遵循 htaccess 規則檔案。確保將此新規則放在 htaccess 檔案的頂部(在 https 規則之后(更改 http --> https 規則),以防 htaccess 檔案中存在任何內容)。
還要確保在測驗 URL 之前清除瀏覽器快取。
RewriteEngine ON
##Put your new rule here..
RewriteRule ^faq/question/ /faq? [R=301,L,NC]
###Make sure to keep rest of your urls here onwards...
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/466552.html
標籤:.htaccess 重定向 改写 http-status-code-301
