簡體   English   中英

顯示根頁面而不更改子文件夾htaccess規則的url

[英]Show root pages without changing url of the sub folder htaccess rules

我有wordpress網站abc.com,網址格式為

網址1:abc.com/Rebeka/

網址2:abc.com/shops/Rebeka/

例如,此處的Rebeka是存在於根目錄(URL 1)上的帖子名稱,但不存在於/ shops /文件夾下。

在這里,我想保持兩個url正常工作,只有更改是/ shops /文件夾才能顯示根目錄中的帖子(如果缺少任何帖子)。

您能幫我了解/ shops /文件夾或根文件夾的htaccess規則嗎? 或其他解決方案?

在htaccess文件根目錄中:

RewriteEngine on
#If /shop/foobar file does not exist 
RewriteCond %{DOCUMENT_ROOT}/shop/$1 !-f
#rewrite /shop/foobar to /foobar (root)
RewriteRule ^shop/([^/]+)/?$ /$1 [L]

這應該可以正常工作:

RewriteEngine On
RewriteRule /shops/(.*) /$1 [L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM