Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2015-02-06
3
Medium Priority
?
133 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 18

Accepted Solution

by:
Lucas Bishop earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Some of the SEO trends we might expect in 2017.
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…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
Suggested Courses
Course of the Month6 days, 22 hours left to enroll

782 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