0

I have single web application on the server with multiple domain names (pittsburgh-app.com, philadelphia-app.com, etc).

Now the domain names are changing to (new-pittsburgh-app.com, new-philly-app.com, and so on).

So when I setup the following redirection in a new conf file it works:

<VirtualHost *:8080>   ServerName pittsburgh-app.com
  RewriteEngine on
  RewriteRule ^/(.*) http://new-pittsburgh-app.com/$1 [L,R=301]
</VirtualHost>

But the second redirection does not:

<VirtualHost *:8080>   ServerName philadelphia-app.com
  RewriteEngine on
  RewriteRule ^/(.*) http://new-philly-app.com/$1 [L,R=301]
</VirtualHost>

Can I not setup multiple redirections this way?

NB: I setup the second redirection in a separate conf file as well. Port 8080 necessary because that's what the load balancer uses.

  • Try use %{SERVER_NAME} – alexus Mar 3 '15 at 20:29
0

I think the virtual host directives need to be unique, the two you have listed seem to be the same:

old: <VirtualHost *:8080>

new: <VirtualHost www.pittsburgh-app.com:8080>

etc.

  • Then I get the following error: [error] (EAI 2)Name or service not known: Could not resolve host name pittsburgh-app.com -- ignoring! Note that I am doing this on a test server and my laptop's hosts file is pointing to the test server's ip but urls are not setup on a public dns – Rayhan Muktader Mar 3 '15 at 20:57
  • have you tried with without the www? – Terry Kernan Mar 3 '15 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.