Reputation: 125
I moved a portion of the site to a subdomain. All answers I find here are without keeping the folder structure in mind.
So
http://mywebsite.com/projects
Has become
http://topic.mywebsite.com/projects
So what I have now is:
RedirectMatch 301 ^/projects/(.*)$ http://topic.mywebsite.com/projects/$1
But this creates an infinite loop. So I tried
RedirectMatch 301 http://mywebsite.com/projects/(.*)$ http://topic.mywebsite.com/projects/$1
So it does not get into a loop on the subdomain, but this does not work at all.
Any idea?
Upvotes: 1
Views: 296
Reputation:
You can use mod_rewrite
and check that it only runs for the main site.
RewriteCond %{HTTP_HOST} =mywebsite.com
RewriteRule ^projects/(.*)$ http://topic.mywebsite.com/projects/$1 [R=301,L]
Upvotes: 1