You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dave Henderson <dh...@digital-pipe.com> on 2007/05/05 23:52:58 UTC
[users@httpd] single webpage redirect
Gang,
I am trying to perform a redirect to another server when accessing a single webpage. Currently there are two sites connected over a WAN that both have Apache running to serve content. However, just one of these locations contains user database information (for logging into the websites). Is it possible to tell Apache that when a specfic URL is accessed (eg http://www.sitename.com/login.html) to be redirected to the server containing the user database (located at a different IP address of course)? I have looked on their website and don't think that the redirect directive will work. Although something like the RedirectMatch may. Any help would greatly be appreciated.
Thanks,
Dave
Re: [users@httpd] single webpage redirect
Posted by Dave Henderson <dh...@digital-pipe.com>.
That makes sense. Anyhow, I took your advice from the previous post and once again I would like to thank you for your help, all it working just as I asked.
Dave
Joshua Slive <jo...@slive.ca> wrote: On 5/6/07, Dave Henderson wrote:
> You were right, that worked like a charm! Why wouldn't a ServerAlias
> provide the same functionality?
Because with a ServerAlias, the redirect will again hit the same
, causing the redirect to applied again, causing a loop.
You need the separate so that one name will be
redirected and the other won't.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] single webpage redirect
Posted by Joshua Slive <jo...@slive.ca>.
On 5/6/07, Dave Henderson <dh...@digital-pipe.com> wrote:
> You were right, that worked like a charm! Why wouldn't a ServerAlias
> provide the same functionality?
Because with a ServerAlias, the redirect will again hit the same
<VirtualHost>, causing the redirect to applied again, causing a loop.
You need the separate <VirtualHost> so that one name will be
redirected and the other won't.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] single webpage redirect
Posted by Dave Henderson <dh...@digital-pipe.com>.
On 5/6/07, Dave Henderson wrote:
> The site2 is working fine and redirecting correctly. It is site1 that
> contains the userdata that I would like to "redirect".
Just flip site2 and site1 in my description.
> I did try to use the
> redirect statement on the site1 server, but that didn't work. It gave me
> the following error:
>
> The page isn't redirecting properly
>
> Firefox has detected that the server is redirecting the request for this
> address in a way that will never complete.
>
>
> I am thinking there is an endless loop thats happening since the redirect is
> redirecting requests for the login.html to go to the same computer acessing
> the same document. Everytime it requests that document, it redirects it. I
> tried using a ServerAlias directive, but that didn't work either. Wouldn't
> that have accomplished the same goal as creating an entirely new
> virtual-vhost in this situation?
As I said, you need to setup a for login on the same
machine as site1. Then you put the Redirect only in the
for site1. That way, when you get redirected to login, you won't hit
the redirect again causing a loop. (The same thing can be done with
mod_rewrite, but using s is simpler.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Joshua,
You were right, that worked like a charm! Why wouldn't a ServerAlias provide the same functionality?
Dave
Re: [users@httpd] single webpage redirect
Posted by Joshua Slive <jo...@slive.ca>.
On 5/6/07, Dave Henderson <dh...@digital-pipe.com> wrote:
> The site2 is working fine and redirecting correctly. It is site1 that
> contains the userdata that I would like to "redirect".
Just flip site2 and site1 in my description.
> I did try to use the
> redirect statement on the site1 server, but that didn't work. It gave me
> the following error:
>
> The page isn't redirecting properly
>
> Firefox has detected that the server is redirecting the request for this
> address in a way that will never complete.
>
>
> I am thinking there is an endless loop thats happening since the redirect is
> redirecting requests for the login.html to go to the same computer acessing
> the same document. Everytime it requests that document, it redirects it. I
> tried using a ServerAlias directive, but that didn't work either. Wouldn't
> that have accomplished the same goal as creating an entirely new
> virtual-vhost in this situation?
As I said, you need to setup a <VirtualHost> for login on the same
machine as site1. Then you put the Redirect only in the <VirtualHost>
for site1. That way, when you get redirected to login, you won't hit
the redirect again causing a loop. (The same thing can be done with
mod_rewrite, but using <VirtualHost>s is simpler.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] single webpage redirect
Posted by Dave Henderson <dh...@digital-pipe.com>.
On 5/6/07, Dave Henderson wrote:
> Guys,
>
> I have another question. This one is just to maintain uniformity and is
> not a must. I adjusted the apache server that doesn't contain the user
> database (site2) to use the database at site1 by redirecting the login.html
> to login.server.com. This is working just fine when people access the
> site2's apache server. If the people use the site1 apache server, no
> redirection is required (obviously), but I would like the url to remain
> consistant between the two sites when people access the webpage. Is there a
> way to mask the url on site1's apache server to read as login.server.com
> instead of the actual server name. I already have dns setup and working
> correctly (since site2 works fine), I would just like this to be uniform.
Just use a normal name-virtual-vhost configuration to setup
login.server.com as a virtual host on the site2 machine (evidently
sharing all the same configuration as site2). Then do a redirect from
the site2 virtualhost to the login virtual host, just as you did on
site1.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Joshua,
The site2 is working fine and redirecting correctly. It is site1 that contains the userdata that I would like to "redirect". I did try to use the redirect statement on the site1 server, but that didn't work. It gave me the following error:
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
I am thinking there is an endless loop thats happening since the redirect is redirecting requests for the login.html to go to the same computer acessing the same document. Everytime it requests that document, it redirects it. I tried using a ServerAlias directive, but that didn't work either. Wouldn't that have accomplished the same goal as creating an entirely new virtual-vhost in this situation?
Thanks,
Dave
Re: [users@httpd] single webpage redirect
Posted by Joshua Slive <jo...@slive.ca>.
On 5/6/07, Dave Henderson <dh...@digital-pipe.com> wrote:
> Guys,
>
> I have another question. This one is just to maintain uniformity and is
> not a must. I adjusted the apache server that doesn't contain the user
> database (site2) to use the database at site1 by redirecting the login.html
> to login.server.com. This is working just fine when people access the
> site2's apache server. If the people use the site1 apache server, no
> redirection is required (obviously), but I would like the url to remain
> consistant between the two sites when people access the webpage. Is there a
> way to mask the url on site1's apache server to read as login.server.com
> instead of the actual server name. I already have dns setup and working
> correctly (since site2 works fine), I would just like this to be uniform.
Just use a normal name-virtual-vhost configuration to setup
login.server.com as a virtual host on the site2 machine (evidently
sharing all the same configuration as site2). Then do a redirect from
the site2 virtualhost to the login virtual host, just as you did on
site1.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] single webpage redirect
Posted by Dave Henderson <dh...@digital-pipe.com>.
Guys,
I have another question. This one is just to maintain uniformity and is not a must. I adjusted the apache server that doesn't contain the user database (site2) to use the database at site1 by redirecting the login.html to login.server.com. This is working just fine when people access the site2's apache server. If the people use the site1 apache server, no redirection is required (obviously), but I would like the url to remain consistant between the two sites when people access the webpage. Is there a way to mask the url on site1's apache server to read as login.server.com instead of the actual server name. I already have dns setup and working correctly (since site2 works fine), I would just like this to be uniform.
Thanks,
Dave
Dave Henderson <dh...@digital-pipe.com> wrote: Thanks Joshua and The Gaijin. I ended up using Joshua's suggestion (I also had to modify my dns settings), but it worked beautifully.
Thanks again!
Dave
Joshua Slive <jo...@slive.ca> wrote: On 5/5/07, The Gaijin wrote:
>
> RewriteEngine On
> RewriteRule /login.html http://other.server.domain/login_url [R]
This case can be replaced simply with
Redirect /login.html http://other.server.domain/login_url
which doesn't require mod_rewrite.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] single webpage redirect
Posted by Dave Henderson <dh...@digital-pipe.com>.
Thanks Joshua and The Gaijin. I ended up using Joshua's suggestion (I also had to modify my dns settings), but it worked beautifully.
Thanks again!
Dave
Joshua Slive <jo...@slive.ca> wrote: On 5/5/07, The Gaijin wrote:
>
> RewriteEngine On
> RewriteRule /login.html http://other.server.domain/login_url [R]
This case can be replaced simply with
Redirect /login.html http://other.server.domain/login_url
which doesn't require mod_rewrite.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] single webpage redirect
Posted by Joshua Slive <jo...@slive.ca>.
On 5/5/07, The Gaijin <ga...@gci.net> wrote:
>
> RewriteEngine On
> RewriteRule /login.html http://other.server.domain/login_url [R]
This case can be replaced simply with
Redirect /login.html http://other.server.domain/login_url
which doesn't require mod_rewrite.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] single webpage redirect
Posted by Dave Henderson <dh...@digital-pipe.com>.
Thank Gaigin. I will do some more research.
The Gaijin <ga...@gci.net> wrote: On Sat, 2007-05-05 at 14:52 -0700, Dave Henderson wrote:
> Gang,
>
> I am trying to perform a redirect to another server when accessing
> a single webpage. Currently there are two sites connected over a WAN
> that both have Apache running to serve content. However, just one of
> these locations contains user database information (for logging into
> the websites). Is it possible to tell Apache that when a specfic URL
> is accessed (eg http://www.sitename.com/login.html) to be redirected
> to the server containing the user database (located at a different IP
> address of course)? I have looked on their website and don't think
> that the redirect directive will work. Although something like the
> RedirectMatch may. Any help would greatly be appreciated.
>
> Thanks,
>
> Dave
Make sure mod_rewrite is loaded and add a rule like so:
RewriteEngine On
RewriteRule /login.html http://other.server.domain/login_url [R]
which will redirect all occurences to that page. Or you could proxy the
connection through to the other server, making it transparent for the
end user:
RewriteRule /login.html http://other.server.domain/login_url [P]
The documentation for mod_rewrite will give you all the details, and
probably a few more ideas as well.
R.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] single webpage redirect
Posted by The Gaijin <ga...@gci.net>.
On Sat, 2007-05-05 at 14:52 -0700, Dave Henderson wrote:
> Gang,
>
> I am trying to perform a redirect to another server when accessing
> a single webpage. Currently there are two sites connected over a WAN
> that both have Apache running to serve content. However, just one of
> these locations contains user database information (for logging into
> the websites). Is it possible to tell Apache that when a specfic URL
> is accessed (eg http://www.sitename.com/login.html) to be redirected
> to the server containing the user database (located at a different IP
> address of course)? I have looked on their website and don't think
> that the redirect directive will work. Although something like the
> RedirectMatch may. Any help would greatly be appreciated.
>
> Thanks,
>
> Dave
Make sure mod_rewrite is loaded and add a rule like so:
RewriteEngine On
RewriteRule /login.html http://other.server.domain/login_url [R]
which will redirect all occurences to that page. Or you could proxy the
connection through to the other server, making it transparent for the
end user:
RewriteRule /login.html http://other.server.domain/login_url [P]
The documentation for mod_rewrite will give you all the details, and
probably a few more ideas as well.
R.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org