[英]Redirect every trailing folder to main folder
我有幾個不想重定向的網址:
/faq/
/faq/question/1-title
/faq/question/2-title
我希望所有 /faq/question/* url 都重定向到 /faq,這可能嗎?
我有這個,但這不起作用:
RedirectMatch 301 ^/faq/question/([^/]+)/?$ /faq
使用您顯示的示例/嘗試,請嘗試使用以下 .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...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.