[英]How to redirect a sub directory except for the landing page?
我需要將子目錄/plays/
下的所有 WordPress 帖子重定向到主目錄 ( /
),但登錄頁面除外。
example.com/plays/hello
您將被重定向到example.com/hello
example.com/plays
或example.com/plays/
您將停留在該頁面上。 我怎樣才能做到這一點? 我假設它必須通過.htaccess
重定向來完成,但我不知道如何。
以下規則應該有效:
RewriteEngine on
#if the request is for "/plays" or "/plays/", skip the rule#
RewriteCond %{REQUEST_URI} !^/plays/?$
#otherwise redirect to homepage#
RewriteRule ^plays/(.+)$ http://domain.com/$1 [R,L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.