View Full Version : Moving Entire Site into another Folder

05-01-2007, 08:37 AM
I've an ecommerce site which is fairly popular with google, but I need to move it to a different folder to make room for other products. I sell scooters, but am now wanting to have a section to sell jewelery, toys, and accessories. So each one will have its own folder with all of them linked to the index page.

What I'm wondering is how I can move the existing pages to a folder and yet still be able to (1)have google find them, (2) have google know it's still the same content just in a different place, and (3) let google know the pages are permanently moved, change its links and stop crawling the old pages.

How would I go about this?

And I say "google", but also mean all search engines.

05-01-2007, 11:08 AM
there's a thing called a "301 redirect", which is the code that a page has been permenantly moved. you can read how to use it here (http://en.wikipedia.org/wiki/URL_redirection#HTTP_status_codes_3xx).

probably the easiest way to do it is with .htaccess. (as shown here (http://en.wikipedia.org/wiki/URL_redirection#Using_.htaccess_for_Redirection)). if you need more info, you cold probably find it on a search engine with phrases like 301 redirect, maybe add htaccess to it.

05-01-2007, 02:53 PM
I don't understand why you would have "old pages" ...

What if you had a separate directory for each section that only
contained photos, and then had one catalog file that contained a
list of items, their descriptions, prices, path to the photo ... and your
index file was index.php ... a PHP script that would dynamically display
your items using that catalog file. You would not have any other HTML
pages, no static HTML pages, the other directories would only be used
to store your images.

To add items, you would add a couple of images to the appropriate
directory, add a line item to the catalog.db (text file) and you're done.

The only file the search engines would be concerned about was "index.php".

That's typically what an online ecommerce site is like ... most use
MySQL, but a simple flat-file (text file) would be the same type of thing.

Websites usually don't have static pages anymore.

05-01-2007, 06:40 PM
Either way, the existing pages are going to move to a new URL (either a new directory or to a URL structure based on index.php using query strings, which by the way isn't a particularly good idea), hence the requirement for correct redirects to be in place.

Croationkid is right, a 301 redirect is the correct way forward and .htaccess is your best option providing you're on an apache server.

05-01-2007, 10:25 PM
Thanks guys, the 301 redirect was what I was looking for.

mlseim: "old pages" meaning the URL of where the pages are now with respect to the duplicate ones in the new folder. The "old" URLs will have to stay for a while until google understands that everything has moved.

Here's the sample PHP code I ended up using for this (tested and works):

$sn = getenv("SCRIPT_NAME");

header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.mysite.com/folder$sn");

05-31-2007, 11:11 AM

One month later and Google still insists on indexing the old pages. I've also noticed that my search ranking has now slipped off the first AND second pages - I'm now being listed on the third google page!

WTF is going on here? My sales and visitors have dropped to almost nothing!

05-31-2007, 01:34 PM
did you double check the header response?

What's the URL of your site and the pages in question?

05-31-2007, 09:47 PM
How do I check a header response?

basestationzero.com/ forwarding to basestationzero.com/xtreme/