Solved

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

Posted on 2015-02-06
3
90 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 16

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Webserver access problem 5 73
ip / url redirect 13 71
Apache / XAMPP  authorisation 10 55
Create sub domain on windows dedicated server. 13 61
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
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.

773 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