Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Missing something very basic with 301 & 404 redirects

6:14 pm on Sep 5, 2013 (gmt 0)

New User

10+ Year Member

joined:Sept 24, 2004
posts: 12
votes: 0

My assumption is that you could mix 301 and 404 lines in .htaccess files so that you can redirect specific pages and then use a 404 redirect to mop up the rest to a custom 404 error page.
But seemingly not?

My assumption was something like that below, but no it doesn't seem to like it.

Redirect 301 /1.htm /a.htm
Redirect 301 /2.htm /b.htm
Redirect 301 /3.htm /c.htm
Redirect 404 /custom404.htm

Am I going about this in entirely the wrong manner or is the objective just not possible, its 301 or 404 but not both?
6:42 pm on Sept 5, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:July 19, 2013
votes: 0

Redirect 404 /custom404.htm

You don't want to redirect to an error document, but rather use ErrorDocument for the appropriate status code.

ErrorDocument 404 /custom404.htm


[Delinked to preserve fragment identifier]
7:30 pm on Sept 5, 2013 (gmt 0)

New User

10+ Year Member

joined:Sept 24, 2004
votes: 0

Grrr I knew it was something simple right in front of me.

8:14 pm on Sept 5, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
votes: 244

Redirect 404 /custom404.htm

This line doesn't mean "send user to custom error document". It means "respond to requests for this named document with a 404" presumably leading to exactly the same type of 500-class error that arises when you neglect to poke a hole for your custom 403 document.

:: detour to check something ::

Thought so. The numerical status code in mod_alias behaves exactly the same as the argument to the [R] flag in mod_rewrite: if it's outside the 3xx range, the server simply returns the specified response.

Which reminds me that when I saw the subject line I was afraid it would be a question about mixing mod_alias and mod_rewrite in a single htaccess file.