子域名重定向到主域保持主域

问题描述:

内访问网址我最初有一个WordPress博客亩产在maindomain.com/subdomain子域名重定向到主域保持主域

我要保留,但能够subdomain.maindomain.com/article1重定向到maindomain.com/subdomain/article1

我第一次尝试使用我的主机cpanel创建一个子域,并执行从subdomain.maindomain.com到maindomain.com/subdomain的重定向。令我惊讶的是,它不适用于文章1

所以我回滚并寻找另一种解决方案。我发现这Redirect sub domain to main domain without effecting sub folders with .htaccess,但我不知道通配符*和恐惧不能访问我的博客了,所以我想确认:

我应该这样做吗?

enter image description here

如果你有你的htaccess文件的访问,也许你可以尝试添加重写规则(与QSA(查询字符串追加)标志只有当你想保留其它参数,如/第一条?X = Y):

所以,在你subdomain.example.com的htaccess的:

重写规则^(*)。? http://example.com/subdomain/ $ 1 [QSA]