如何仅重定向 Apache 中的子页面/子目录?



我希望所有URL的"下面"example.com/stuff/都重定向到 https://www.other-website.com。例如,example.com/stuff/chair 或 example.com/stuff/table 都会重定向,但 example.com/stuff/不会。

您可以使用 apachemod_rewrite模块来实现相同的目的。

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/stuff$
RewriteRule .? - [S=1]
RewriteRule (.*)  https://www.other-website.com  [R,L]

最新更新