?
Solved

301 Redirects via .htaccess question

Posted on 2008-10-31
5
Medium Priority
?
229 Views
Last Modified: 2012-05-05
I hoping someone can help this Linux newbie understand a problem I need to solve with 301 redirects. I've enabled the AllowOverride Switch in httpd.conf and created the appropriate .htaccess file. I have 2 old pages I wish to redirect to specific new pages. Then, I'd like all the remaining broken links to redirect to the main default page.

What is the best way to accomplish the third redirect shown below. I tried using similar syntax but it didn't seem to work.See code snippet below

Redirect 301 /pages/locations.html      http://www.website.com/storelocator.htm 
Redirect 301 /pages/about.html          http://www.website.com/about.htm
Redirect 301 /pages/ALLOTHERLINKS       http://www.website.com/

Open in new window

0
Comment
Question by:Spiderkingdemon
[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
5 Comments
 
LVL 1

Expert Comment

by:frandshansen
ID: 22853895
Maybe if I were you I'd set up an 404 redirect instead.

You can use the directive ErrorDocument

ErrorDocument 404 http://yoursite.com/
0
 
LVL 27

Accepted Solution

by:
caterham_www earned 500 total points
ID: 22856440
-> RedirectMatch

RedirectMatch 301 ^/pages/ http://www.website.com/

matches /pages/foo.

An ErrorDocument 404 with a http://... will generate a 302 redirect only.
0
 
LVL 12

Expert Comment

by:ShaneJones
ID: 22856832
Do it this way should work fine

Redirect 301 /pages/locations.html "http://www.website.com/storelocator.htm"
Redirect 301 /pages/about.html "http://www.website.com/about.htm"
Redirect 301 /pages/ALLOTHERLINKS "http://www.website.com/"

Open in new window

0
 

Author Closing Comment

by:Spiderkingdemon
ID: 31512154
Thank you! This was the answer.
0
 

Author Comment

by:Spiderkingdemon
ID: 22857053
Shane -- thanks for you post but I tried that and it did not work. Caterham-www's answer worked perfect.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

771 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