Solved

.htaccess 301 redirects - Is this the best way to do this?

Posted on 2015-02-06
3
95 Views
Last Modified: 2015-03-14
I need to 301 redirect all pages from an old website to our main website. The old website uses a custom CMS system and we do not have access to the server / not possible to configure redirects here.

My idea is to point the old website domain to our webserver and setup 301 redirects in the .htaccess file like this:

Redirect 301 /oldpage.html http://www.example.com/newpage.html

Open in new window


My question is, do I need to have actual html files in the site for the 301 redirects to work? Also, is my above code sound?

Thank You
0
Comment
Question by:Mark B
3 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40594512
My question is, do I need to have actual html files in the site for the 301 redirects to work?

No.

Also, is my above code sound?

Yes, for a single page.  If the redirects are a predictable pattern (/oldpage.html to newsite.com/samepagename.html) you would probably want to use a single mod_rewrite rule to do it with a regular expression.
0
 
LVL 17

Accepted Solution

by:
Lucas Bishop earned 500 total points
ID: 40595851
Since you don't have access to the old server and the htaccess file you're editing here is on the local server, you don't actually need to include the domain name. Hence your code would be to the effect of:

Redirect 301 /oldpage.html /newpage.html

Open in new window


An easy way to go about this on a large scale, if the pages don't follow a common naming convention, would be to:
1.) Create a spreadsheet
2.) download a sitemap of your old site
3.) put old site page list in column A
4.) put new site page list mapping in column B
5.) Concatenate "Redirect 301 " to the front of Column A + Column B

Then you'll have a full listing of all your redirects you can paste into your htaccess
0
 

Author Closing Comment

by:Mark B
ID: 40665300
Thank you, this worked great.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wondering how you can get your new website ranking on Google Search so that people find you online?  The answer is Search Engine Optimization (SEO). So how do you Start Ranking a New site with SEO?  Below is a starter guide to get your new website S…
If you don’t want your company's site to fail on the web, you’d do well to observe these best web design practices and make sure you implement them when applicable.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question