[英]htaccess, redirect to specific URL
I created a new website for a club. 我为俱乐部创建了一个新网站。 It has a new Domain as well as different directory structure. 它具有一个新的域以及不同的目录结构。 The important pages are correctly redirected, but i want to add a catch all on the old domain to the root of the new domain. 重要页面已正确重定向,但我想将旧域上的所有内容都添加到新域的根目录中。 I already tried various things, currently (on the old domain and host): 我已经尝试了各种方法,目前(在旧域和主机上):
RedirectMatch 301 ^/?$ https://newdomain.com/
but whatever I try, this 但是不管我怎么尝试
olddomain.com/sub1/page1
is always redirecting to 总是重定向到
newdomain.com/sub1/page1
How do I make a rule, catching all pages and redirecting to a specific URL without attaching the path to the target? 如何制定规则,捕获所有页面并重定向到特定URL,而不将路径附加到目标?
Thanks! 谢谢!
The pattern ^/?$
only matches /
the homepage of your olddomain ie http://olddomain.com/
. 模式^/?$
仅匹配/
olddomain的首页,即http://olddomain.com/
。 You need to repace your current pattern with ^/sub1/page1
so that your http://olddomain.com/sub1/page1
can redirect to http://newdomain.com
. 您需要使用^/sub1/page1
替换当前模式,以便您的http://olddomain.com/sub1/page1
可以重定向到http://newdomain.com
。
Change 更改
RedirectMatch 301 ^/?$ https://newdomain.com/
To 至
RedirectMatch 301 ^/sub1/page1$ https://newdomain.com/
If /page1
is a dynamic value you can replace it with .+
. 如果/page1
是动态值,则可以将其替换为.+
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.