homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

htaccess redirect
server returns 501 error

 1:26 pm on May 7, 2002 (gmt 0)


I have transferred pages from the root into a folder and want to redirect SE's to the new location via redirectpermanent.

I used the following

RedirectPermanent /oldlocation.htm /http://www.mydomain/folder/newlocation.htm

and it always returns a 501 server error

I also tried

Redirect 301 (rest as above ....)


Redirect permanent (rest as above...)

This is the ONLY line in the .htaccess file - should there be something else in there?



 1:37 pm on May 7, 2002 (gmt 0)

No need for leading slash on "http:" i.e.
RedirectPermanent /oldlocation.htm [mydomain...]
should work.

If you want to redirect all files, rather than just oldlocation.html, try:
RedirectPermanent / [mydomain...]

Here's one I pulled off one of my old servers that I am actually using to redirect a "homepage" type account (with the tilde-name setup):
RedirectPermanent /~quux-corp/ [quux-corp.com...]

Hope this helps!


 1:37 pm on May 7, 2002 (gmt 0)

I think you have one to many forward slashes...
RedirectPermanent /oldlocation.htm /http://www.mydomain/folder/newlocation.htm

it think it should read

RedirectPermanent /oldlocation.htm [mydomain...]

I don't believe you want the "/" before the [.....]

I just checked mine and I dont have that "/" in my redirects.


 1:50 pm on May 7, 2002 (gmt 0)

Sorry about that - it was typo...

should have read:

RedirectPermanent /oldlocation.htm [mydomain...]

with no breaks

btw, thanks for the speedy response...


 2:16 pm on May 7, 2002 (gmt 0)


Error code 501 is "Not implemented" - I wonder if that's the problem?

You could try:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^oldlocation.htm$ [mydomain...] [R=permanent]

(Note: The RewriteRule all goes on one line, but appears wrapped to two or three lines here in the forum. The rule starts with "RewriteRule" and ends with "[R=permanent]")

I'm assuming that you only want to redirect the single file called "oldlocation.htm".

It may also be that your hosting service has not installed mod_rewrite, which is an optional module available in Apache 1.2 and later.


 2:28 pm on May 7, 2002 (gmt 0)

Sorry, thinking one thing, and wrote something else... I meant to say:
It may be that your hosting provider has disabled .htaccess using AllowOverride None.
RedirectPermanent is part of mod_alias, not part of mod_rewrite. Doh!
Your RedirectPermanent (without the "/" in front of "http:") otherwise looks correct.


 3:57 pm on May 7, 2002 (gmt 0)

Thanks Guys

Its working great now - the host had not enabled htaccess - the code was actually fine.

...but being a novice you always think you have done something wrong...and often have!


 7:00 pm on May 7, 2002 (gmt 0)


Glad to hear you got it working!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved