View previous topic :: View next topic |
Author |
Message |
Clapper Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/162677586043c713d774dc6.jpg)
Joined: 29 Sep 2003 Posts: 177
|
Posted: Thu Oct 28, 2004 2:48 pm Post subject: Apache - redirect port 81 to single page |
|
|
Hello,
Is it possible to configure apache to where, if anyone attempts to access the server on a singe port, port 81, that it goes to a specified web page, no matter what the trailing end of the url is?
How would I do this?
At one time I had a domain that ran on port 81. The server no longer runs on 81, but, I want to somehow direct all port 81 connections to a single page, informing them of this, and directing them to the root index page.
Any ideas? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
ocbMaurice Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/Monkey Island/Monkey_Island_-_Guybrush2.gif)
Joined: 14 Feb 2003 Posts: 90 Location: Switzerland
|
Posted: Thu Oct 28, 2004 3:25 pm Post subject: |
|
|
That should be possible with several methods. Not sure which is the best, as it is always when there is more than one way to do it.
with virtualhosts and mod_alias :
<VirtualHost *:81>
# if you want to redirect /abc to http://foo2.bar.com/abc
Redirect / http://foo2.bar.com/
# if you want to redirect all to a single page, you might use
RedirectMatch (.*) http://www.some.host/some.page
</VirtualHost>
or with mod_rewrite something like this might work too :
RewriteCond %{SERVER_PORT} ^81*
RewriteRule ^.*$ /homepage.max.html
of course, dont forget to set apache to listen on port 81 too
I have not tested if the above will work, but IMO one of them should, just give it a try and otherwise read the manuals for mod_alias or mod_rewrite !
greets, Maurice
ps. It's no problem to run one apache on multiple ports, just lookup the "listen" option (http://httpd.apache.org/docs/mod/core.html#listen) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Clapper Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/162677586043c713d774dc6.jpg)
Joined: 29 Sep 2003 Posts: 177
|
Posted: Thu Oct 28, 2004 5:05 pm Post subject: |
|
|
Thanks *so* much! This did it for me in 5 seconds of editing of apache.conf. I have been worrying about how to address this for a while! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
ocbMaurice Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/Monkey Island/Monkey_Island_-_Guybrush2.gif)
Joined: 14 Feb 2003 Posts: 90 Location: Switzerland
|
Posted: Thu Oct 28, 2004 5:31 pm Post subject: |
|
|
yu're welcome
Just a note, it's maybe better to use the alias* and not the redirect* options to save some cpu and bandwidth if both servers are on the same machine (read manual to get the difference) ! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|