Redirect sub domain to main domain without effecti

2019-08-17 16:55发布

My situation is as follows:

  • I've have a new website at my main domain. Example: mywebsite.com.
  • My old portfolio is located at an old sub domain: portfolio.mywebsite.com.
  • All portfolio items can be found in a sub directory at the portfolio site.
  • So portfolio item 1 can be found at portfolio.mywebsite.com/item-1, etc.
  • The sub domain is running WordPress with Multisite enabled.
  • The sub domain and main domain are hosted by different web hosts.

I want to redirect all traffic from portfolio.mywebsite.com to mywebsite.com/portfolio. But I don't want to redirect traffic from the portfolio items, since I don't have time to build a new portfolio yet. Therefor I also need to be able to acces the wp-admin folder on the sub domain.

In short: How do I redirect traffic from portfolio.mywebsite.com to mywebsite.com/portfolio without effecting all the other urls? :)

Best regards,

Michael

2条回答
祖国的老花朵
2楼-- · 2019-08-17 17:49

Try placing this redirect rule in root of portfolio.mywebsite.com as very first rule:

RewriteEngine On

RewriteRule ^([^/]+)/?$ http://mywebsite.com/portfolio [L,NE,R=302]
查看更多
姐就是有狂的资本
3楼-- · 2019-08-17 17:57

If i understand well your problem i think that you can use a simple plugin for redirection like Safe Redirect Manager

It's very simple to use.

查看更多
登录 后发表回答