LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 03-24-2013, 12:13 AM   #1
gene292
LQ Newbie
 
Registered: Jul 2011
Distribution: ubuntu 12.04
Posts: 16

Rep: Reputation: Disabled
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
 
Old 03-24-2013, 04:31 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,907

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
Hi,

You can add:
Code:
ServerAlias 192.168.x.x
into the said vhost config file

Regards
 
Old 03-24-2013, 08:22 AM   #3
gene292
LQ Newbie
 
Registered: Jul 2011
Distribution: ubuntu 12.04
Posts: 16

Original Poster
Rep: Reputation: Disabled
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?
 
Old 03-24-2013, 10:52 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,907

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
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.
 
Old 03-24-2013, 11:57 AM   #5
gene292
LQ Newbie
 
Registered: Jul 2011
Distribution: ubuntu 12.04
Posts: 16

Original Poster
Rep: Reputation: Disabled
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.
 
  


Reply

Tags
apache2, redirect


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
want to redirect www.domain.com/folder www.domain100.com figure20012 Linux - Newbie 2 09-27-2012 10:32 PM
how to get mail alert when http path /var/www/html get accessed saravanakumar Linux - Server 1 07-26-2011 03:45 PM
Apache: Change http://localhost to http://www.mywebsite.com mlandvo Linux - Server 1 08-12-2010 08:47 AM
Apache https redirect without-www to with-www alitrix Linux - Server 3 07-24-2008 06:11 AM
apache: http redirect for any request going to www.foo.com/* psychobyte Linux - Software 1 04-11-2005 05:57 PM


All times are GMT -5. The time now is 05:25 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration