Solved

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

Posted on 2015-02-06
3
102 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Google search result shows " This site may be hacked" 12 130
how Adwords bidding happens 1 83
Google Review Question 15 74
AWS EC2 HTTP & HTTPS 2 119
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
What You Need to Know when Searching for a Webhost Provider
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.

751 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