LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   http redirect /var/www on ubuntu12.04 (http://www.linuxquestions.org/questions/linux-server-73/http-redirect-var-www-on-ubuntu12-04-a-4175455327/)

gene292 03-24-2013 12:13 AM

http redirect /var/www on ubuntu12.04
 
I've setup several virtual hosts by using a2ensite.
That works fine. What I would like to change is the access to:
http://192.168.x.x
Right now it goes to /var/www/index.html
I would like to change that to one of my vertual servers.
I know I can do:
cd /var/
mv www www_orig
ln -s /home/my/virtul/server1 www

Is this the best way? I would rather use some kind of redirect.
I am having trouble figuring out exactly how to use apache Redirect
and if it is applicable to my situation/goal.
The same with Alias.
Really do not want to use mod_rewrite, even if it applies.

still a lot to learn.... :-(
gene

bathory 03-24-2013 04:31 AM

Hi,

You can add:
Code:

ServerAlias 192.168.x.x
into the said vhost config file

Regards

gene292 03-24-2013 08:22 AM

Code:

ServerAlias 192.168.x.x
Thanks, it worked for 192.168.x.x
However, I also have external access enabled through the router (137.x.y.z) to that server.
And now those http requests still go to /var/www/index
How do I change that?

bathory 03-24-2013 10:52 AM

Quote:

However, I also have external access enabled through the router (137.x.y.z) to that server.
And now those http requests still go to /var/www/index
How do I change that?
You can use /etc/apache2/sites-available/default to define the vhost in question. This way any request that does not correspond to a specific vhost (like 137.x.y.z, 192.168.x.x etc) will be served by your vhost that is also the default one.

gene292 03-24-2013 11:57 AM

Thanks. Great point to modifying default.
I've changed default's root path and everything works as expected.
If nobody else adds anything - I'll mark it solved in a few days.


All times are GMT -5. The time now is 07:40 AM.