I have two redirects on my site. One of them is working, and one of them is not. Here are the relevant lines from my configuration, edited to protect the innocent.
<VirtualHost *:80>
ServerName notworking.com
ServerAlias www.notworking.com
Redirect permanent / http://example.com/units/
</VirtualHost>
<VirtualHost *:80>
ServerName working.com
ServerAlias www.working.com
Redirect permanent / http://example.com/widgets/
</VirtualHost>
The second redirect is working fine. When I visit working.com, my logs look like this:
1.2.3.4 - - [06/Feb/2015:16:08:07 +0000] "GET / HTTP/1.1" 301 241
1.2.3.4 - - [06/Feb/2015:16:08:07 +0000] "GET /widgets/ HTTP/1.1" 200 49257
The first redirect is not working. When I visit notworking.com, my logs look like this:
1.2.3.4 - - [06/Feb/2015:16:08:23 +0000] "GET / HTTP/1.1" 200 50003
Here is the VirtualHost configuration from apachectl -S
VirtualHost configuration:
*:80 is a NameVirtualHost
default server something.example.com (/opt/lampp/etc/httpd.conf:55)
port 80 namevhost something.example.com (/opt/lampp/etc/httpd.conf:55)
port 80 namevhost something.example.com (/opt/lampp/etc/httpd.conf:60)
port 80 namevhost notworking.com (/opt/lampp/etc/httpd.conf:65)
alias www.notworking.com
port 80 namevhost working.com (/opt/lampp/etc/httpd.conf:71)
alias www.working.com
port 80 namevhost example.com (/opt/lampp/etc/httpd.conf:77)
port 80 namevhost www.example.com (/opt/lampp/etc/httpd.conf:82)
port 80 namevhost something-else.othersite.com (/opt/lampp/etc/httpd.conf:87)
alias something-else.othersite.com
port 80 namevhost localhost (/opt/lampp/etc/httpd.conf:95)
Again, all of the other aliases, redirects are working as expected. Perhaps it is something to do with the other one's or the order?
EDIT: a bit of additional information: notworking.com was previously redirected to example.com through DNS. Perhaps this has something to do with it? Is the DNS cached somewhere? I've tried it with a fresh cache in my browser.