Forum Home
Press F1
 
Thread ID: 115533 2011-01-22 11:50:00 Apache webserver Expert tarzan1234 (16188) Press F1
Post ID Timestamp Content User
1171748 2011-01-22 11:50:00 Hi all,
i have linux web server with single IP and i have 4 website on that, one default and 3 virtual host, my question is :
is there any way to make apache when any one type the external ip shows the default web site and when any one use port like IP:2020 apache redirect the user to default website/admin ? and also on othe sites i mean TheFirstSite:2020 redirect to default website/admin and so on ???
i mean something like Cpanel when any one useing Port number the web server redirect the user to user page of Cpanel.

Thanks in Advanced...
tarzan1234 (16188)
1171749 2011-01-22 20:38:00 Yes, you can do this.

The easiest option is probably to put another vhost on port 2020, that does nothing except serve up redirect headers.

:pf1mobmini:
Erayd (23)
1171750 2011-01-23 04:49:00 I'm new in web servers, i didn't get you properly, what i have to do exactly ? tarzan1234 (16188)
1171751 2011-01-23 23:58:00 You need to create a new virtual host that is served via port 2020. This can be created in the same way as you created your other virtual hosts, although you will probably need to add an extra 'listen' directive to your Apache config in order to enable port 2020, unless you've already done this.

This virtualhost should not have a name, and should be specified on all IPs (e.g. <VirtualHost *:2020>).

In the virtualhost config, you will need to define a redirect - this can be done using mod_alias. You can also do this via .htaccess if you'd prefer, although the performance won't be quite as good. The documentation for mod_alias can be found here (httpd.apache.org).

I'd advise you to use RedirectPermanent for this, unless you don't want the redirect being cached for some reason.
Erayd (23)
1171752 2011-01-24 11:52:00 thamks a lot ... tarzan1234 (16188)
1171753 2011-01-24 17:54:00 No problem, and best of luck with what you're trying to achieve :). Erayd (23)
1