致力于网站重新设计。同时,我在example.com
建立了一个登录页面,并将原始网站移至archive.example.com
。
我希望所有带有路径的 url 都可以重定向到存档站点并保留该路径。
example.com/any/directory/path
-> archive.example.com/any/directory/path
显然,我不希望example.com
重定向。
更新:我还需要example.com/admin
才能不重定向
必须有更好的方法来实现这一目标,但以下内容在我的.htaccess
文件中对我有用。
# These redirect subpages to the archive site - ORDER MATTERS
RedirectMatch 302 (/asset-type(.*)) https://archive.example.com/$1
RedirectMatch 302 (/about-us(.*)) https://archive.example.com/$1
RedirectMatch 302 (/news(.*)) https://archive.example.com/$1
RedirectMatch 302 (/portfolio(.*)) https://archive.example.com/$1
RedirectMatch 302 (/services(.*)) https://archive.example.com/$1
RedirectMatch 302 (/development(.*)) https://archive.example.com/$1
RedirectMatch 302 (/investment(.*)) https://archive.example.com/$1