Hey, I'm migrating over a web site store from IIS to Apache. This site hosts hundreds of items, all of which have an item number contained in the URL. The new Apache-hosted site will be a completely new structure, and will also contain the item number in the URL. It will be on the exact same domain name, but just have a new structure. Can I refer all links directed to the old web site to the root directory of my site, and then have an .htaccess file containing a 301 redirect and perimeters for deciphering the requested old URL and forwarding it to the new URL? I don’t want to lose my search engine statistics I currently have for so many aspects of the site. Basically my logic is: A specific Item on invalid link is requested: http://www.example.com/store/items/itemnumber=9217 When link is clicked, Apache recognizes that the requested path and will cache the url, and refer to the root directory of the new example.com website: http://www.example.com/ Contained in the root directory, there will be parameters in the .htaccess file that will recognize that the URL requested is for a link on the old site: http://www.example.com/store/items/itemnumber=9217 The htaccess file will then compare the old path with specific parameters and recognize that it was for a specific item: http://www.example.com/store/items/itemnumber=9217 Once Apache knows it’s a request for an item, it will then collect the item number at the end of the URL: http://www.example.com/store/items/itemnumber=9217 Once collected, it will input the collected value into an appropriate new website URL: http://example.com/index.php/sku=9217 Apache then forwards the page to the new URL, and tells google via the 301 redirect code that the new URL for this page is: http://example.com/index.php/sku=9217 I need Google and other Search engines/links to know the path has changed without hurting my search results. I also need all old requests to be forwarded to the new ones. Will this logic work?
You can easily rewrite URLs like http://www.example.com/store/items/itemnumber=9217 into http://example1.com/index.php/sku=9217 with, for instance, 301 redirects using mod_rewrite. There is a zillion of guides available that explain in detail how to create rules for mod_rewrite out there, google is your friend or post in this thread if you get stuck. Edit: wow this is an old thread.