Localhost Redirect with WAMP

Waddler asked:

I’m new to server fault, but I’ve posted on other SE sites before, so here’s my question:

This is the first time I’ve worked on doing a redirect.
I’m using WAMP with following stack:

  • Apache 2.2.6
  • PHP 5.2.4
  • Connecting to an external test MySQL db

I currently have the following in my (WAMP) httpd.conf file:

<Directory "c:/wamp/www/customername/">
# Redirect to a URL on the same host
Redirect permanent /olddirectoryname/ /newdirectoryname/
</Directory>

I am using customername, olddirectoryname, newdirectoryname as placeholder names for the purposes of posting this question.

This did not appear to be working, so I checked the Apache access log to confirm and is indeed not redirecting. What was odd to me, was that I looked at some of the earlier entries in the access log, and I saw this line:

127.0.0.1 – – [31/Jul/2012:13:05:39 -0500] “GET /customername/olddirectory HTTP/1.1” 301 241

I’m certain the 301 was the redirect, but have no idea what 241 means. I Googled “http code 241” and had nothing relevant in my search results. This seems as if it should be a very simple process, but I’m having some first-timer issues as I work through this.

I also tried setting up a redirection with http://www.google.com/ as well, just to see if that would work, but I did not have the desired results.

I’ve been working from the this Apache documentation: mod_alias

Thanks,
Waddler


I answered:

“241” in this context is the number of bytes transferred.

In Apache’s default log, the HTTP response code appears after the URL (here, 301) followed immediately by the number of bytes in the response body (here, 241).

As for your redirect, all the documentation examples show redirects without the trailing /. So try it that way:

Redirect permanent /old /new

Also, try putting the redirect in the appropriate VirtualHost section rather than in the Directory.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.