Forum Moderators: phranque

Message Too Old, No Replies

301 Redirect from subdomains to folder structure

         

shawnmullaly

5:57 am on Mar 11, 2010 (gmt 0)

10+ Year Member



My website structure is going to change from subdomains to a folder structure. It was [sub.example.com...] and i want it http://www.example.com/sub.

I've read a lot about 301's tonight and haven't seen a solid example showing how go from subdomains to folders. Can someone help me out?

My website is coded in PHP and uses apache. Any help would be great.

g1smd

8:41 am on Mar 11, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What have you tried so far?

There are many example threads [google.com...] to get you started.

shawnmullaly

4:30 pm on Mar 11, 2010 (gmt 0)

10+ Year Member



I'm good! The examples on this website were great. I just had to add the following line to my index:

header("HTTP/1.1 301 Moved Permanently");

g1smd

7:51 pm on Mar 11, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You'll need another line to specify the redirect target/destination.

That is one way, but it can also be done using .htaccess and that method does not rely on there being a physical file on the server.