You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Kory Wheatley <wh...@gmail.com> on 2005/03/08 19:33:50 UTC

[users@httpd] rewrite url to another url

I have Apache 1.3.27 installed on a LAMP server called lx6.isu.edu. 
The server is setup to do dynamic virtual hosting. The main server is
called http://www2d.isu.edu and the document root
 is /var/www/www2d.  

When someone types http://lx6.isu.edu  I would  like it to be
redirected to http://www2d.isu.edu.  The ServerAlias directive will
not work when your using dynamic virtual hosting, because I tried it
out, and also read that it will not work if  virtual hosting is used. 
Right now to get this to work I have a symbolic link in /var/www
called "lx6" and  it's directed to /var/www/www2d.
Example   lx6 -> /var/www/www2d, but I would really like to remove
this, because I don't think it's the best solution.

If it's a Rewrite rule I need, could someone send me an example of
what I need to do here.  I've
got the rewrite_module loaded on the server, but I've never done any
rewrite conditions yet.  I have read the URL Rewriting Guide on the
Apache home site, and I understand bits and pieces off it, but I don't
want to turn the server on and off several times to get this to work. 
I need the server running as much as possible.

Thanks for your help in advance.

---------------------------------------------------------------------
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] rewrite url to another url

Posted by Joshua Slive <js...@gmail.com>.
On Tue, 8 Mar 2005 11:33:50 -0700, Kory Wheatley <wh...@gmail.com> wrote:
> When someone types http://lx6.isu.edu  I would  like it to be
> redirected to http://www2d.isu.edu.  The ServerAlias directive will
> not work when your using dynamic virtual hosting, because I tried it
> out, and also read that it will not work if  virtual hosting is used.
> Right now to get this to work I have a symbolic link in /var/www
> called "lx6" and  it's directed to /var/www/www2d.
> Example   lx6 -> /var/www/www2d, but I would really like to remove
> this, because I don't think it's the best solution.

What's wrong with it?  Dynamic vhosting uses the filesystem as its
vhost database, so putting links in the filesystem seems like the
simplest and clearest way to link vhosts.

Yes, it can be done with mod_rewrite, but I don't see why you'd bother
with that extra complication.  Something like:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^lx6.isu.edu$ [NC]
RewriteRule (.*) /var/www/www2d$1

Joshua.

> 
> If it's a Rewrite rule I need, could someone send me an example of
> what I need to do here.  I've
> got the rewrite_module loaded on the server, but I've never done any
> rewrite conditions yet.  I have read the URL Rewriting Guide on the
> Apache home site, and I understand bits and pieces off it, but I don't
> want to turn the server on and off several times to get this to work.
> I need the server running as much as possible.
> 
> Thanks for your help in advance.
> 
> ---------------------------------------------------------------------
> 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
> 
>

---------------------------------------------------------------------
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