如何将“example.com/some/directory/path”改写为“archive.example.com/



致力于网站重新设计。同时,我在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

相关内容

最新更新