[NTLUG:Discuss] Apache redirect....doesn't
Paul Ingendorf
pauldy at wantek.net
Wed Mar 6 09:44:31 CST 2002
Just a guess but don't you have to define the servername for apache to respond to prior to using a redirect and aren't redirects mean for use by files not urls even though they can redirect files to urls. Just a guess but I'm thinking what you are really looking for is a rewrite rule that will turn your requests into the appropriate www.whatever
Something like
RewriteEngine on
RewriteCond %{SERVER_NAME} !^www.*
RewriteRule ^/(.*) http://www\.%{SERVER_NAME}/$1 [L,R]
You might have to play around with the regex here cause I don't remember if the second argument needs to trap out periods or not but this should work regardless of your domain. Also you might just plug this into the virtual host portion of your config file so it doesn't run on every request to your server as that may or may not cause issues with other virtual hosts you have then simply define aliases for the other addresses you want it to respond to for that doc root remembering to include both the www and the non www versions.
--
-->> mailto:pauldy at wantek.net
-->> http://www.wantek.net/
Running ....... Cos anything else would be a waste...
`:::' ....... ......
::: * `::. ::'
::: .:: .:.::. .:: .:: `::. :'
::: :: :: :: :: :: :::.
::: .::. .:: ::. `::::. .:' ::.
.:::.....................::' .::::..
-----Original Message-----
From: discuss-admin at ntlug.org [mailto:discuss-admin at ntlug.org]On Behalf
Of Richard Geoffrion
Sent: Wednesday, March 06, 2002 8:32 AM
To: discuss at ntlug.org
Subject: Re: [NTLUG:Discuss] Apache redirect....doesn't
----- Original Message -----
From: "Cameron Moore" <lists at unbeatenpath.net>
To: <discuss at ntlug.org>
Sent: Tuesday, March 05, 2002 4:52 AM
Subject: Re: [NTLUG:Discuss] Apache redirect....doesn't
> * ntlug at rain.lewisville.tx.us (Richard Geoffrion) [2002.03.05 02:33]:
> > Can anyone point out what I may be doing incorrectly in trying to
redirect
> > URL1 to URL2?
> >
>
> I'm not exactly sure what you're after, but here's what I do with all my
> vhosts:
>
> <VirtualHost 206.142.128.250>
> ServerAdmin webmaster at unbeatenpath.net
> ServerName unbeatenpath.net
> ServerAlias www.unbeatenpath.net
> DocumentRoot /var/www/vhosts/unbeatenpath.net/html
> ErrorLog /var/www/vhosts/unbeatenpath.net/logs/error.log
> CustomLog /var/www/vhosts/unbeatenpath.net/logs/access.log common
> </VirtualHost>
>
> Note the use of ServerAlias. Is this what you're after?
> --
> Cameron Moore
YES! That is what I'm after. Ok...so I'm going about this the wrong
way....Thank you for straightening me out, Cameron!
BUT!!! That begs the question as to why redirect isn't working? Hmm...I'll
play with Redirect later...after I correct my httpd.conf file!
Thanks all!
-Richard
"Windows is checking Drive C for errors. To avoid this message in the
future, replace this operating system that crashes and prevents you from
shutting down correctly with an operating system that is more stable and
does not need to be rebooted as often..."
_______________________________________________
http://www.ntlug.org/mailman/listinfo/discuss
More information about the Discuss
mailing list