【发布时间】:2021-09-08 18:49:14
【问题描述】:
我正在尝试重定向这些类型的 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/$1/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>
【问题讨论】:
-
除了显示的之外,如果您还有其他 htaccess 规则,请告诉我们吗?
-
我刚刚做到了 :)
-
好的,感谢添加,我现在添加了答案。
标签: .htaccess redirect mod-rewrite url-rewriting friendly-url