将文件夹重定向到子文件夹

Redirect a folder to a subfolder

我正在尝试取消重定向这些类型的 URL:

https://www.example.com/my-account/VARIABLE-FOLDER/

https://www.example.com/my-account/VARIABLE-FOLDER/home/

我不太熟悉 htaccess 的复杂重定向,有人可以帮助我吗?

我试过了但没有结果:

RewriteRule ^my-account/(.*)$ https://www.example.com/my-account/(.*)$/home/ [R=301,NC,L]

现在有我所有的 htaccess 规则:

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

提前致谢


更新#1,我刚试过这个:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(mon-compte/.*)/?$ https://vide.ecoles-libres.fr//home/ [R=301,NC,L]
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

我现在被这样重定向了: https://example.com/my-account/VARIABLE-FOLDER/home/home/home/home/home/home/home/home/home/home/home/home/home/home/home/home/home/home/home//home/

根据您显示的尝试,请尝试以下操作。请在测试您的网址之前清除您的浏览器缓存。

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'
RewriteRule ^(.*)/?$ https://%{HTTP_HOST}/ [R=301,NE,L]

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteRule ^index\.php$ - [L]
##Add an additional condition to check about URI here.
RewriteCond %{REQUEST_URI} !/home [NC]
RewriteRule ^(my-account/.*)/?$ https://www.example.com//home/ [R=301,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>