[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Apace Redirect Question



Make these changes in sites-available files. That is what those files in there are for.
I don't have the specific directive but I can put up one of my servers' apache files for you.

Wolf Halton
http://sourcefreedom.com
Apache developer:
wolfhalton@apache.org

On Nov 2, 2012 9:02 PM, <craig@gtek.biz> wrote:
Good evening folks,

I am trying to teach myself Apache and have run into what seems to be a real
simple problem for which I can not find a solution.

I have two virtual hosts with files in /var/www/htdocs/domain1.com and
/var/www/htdocs/domain2.com. I have a fairly simple configuration file for the
default site that points any requests for my IP address, for http://domain1.com
or for http://domain2.com to a 404 document. The virtual hosts have ServerNames
defined as www.domain1.com and www.domain2.com, and requests to either
http://www.domain1.com or http://www.domain2.com are served the correct pages,
var/www/htdocs/domain1.com/index.html or /var/www/htdocs/domain2.com/index.html.

What I want to do is, if the reqest is for my IP address, or if it is for
http://domain2.com I want the server to continue to serve the ErrorDoc. But I
want to take anything that comes in for http://domain1.com and redirect it to
http://www.domain1.com, with the URL changing in the user's navigation bar (if
that is the correct term). How would I go about accomplishing this goal?

Relevant files (BTW, I am playing on a series of virtual boxes right now):

Myapache2.conf is the stock file from the apache2-mpm-prefork package
installation, with the addition of the following line:
   DefaultType text/plain

/etc/apache2/ports.conf:
   NameVirtualHost *:80
   Listen 192.168.26.10:80

/etc/apache2/sites-available/default:
   <VirtualHost *:80>
      ServerAdmin  webmaster@domain1.com
      ServerName   default
      DocumentRoot /var/www
      ErrorDocument 404 /error404.html

      <Directory />
         Options       FollowSymLinks
         AllowOverride None
      </Directory>

      <Directory /var/www/>
         Options       Indexes FollowSymLinks MultiViews
         AllowOverride None
         Order         allow,deny
         allow from    all
     </Directory>

      # Possible values include: debug, info, notice, warn, error, crit,
      # alert, emerg.
      LogLevel  warn
      ErrorLog  ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
   </VirtualHost>

/etc/apache2/sites-available/domain1:
   <VirtualHost *:80>
      ServerAdmin  webmaster@domain1.com
      ServerName   www.domain1.com
      DocumentRoot /var/www/htdocs/domain1.com

      <Directory />
         Options       FollowSymLinks
         AllowOverride None
      </Directory>

      # Possible values include: debug, info, notice, warn, error, crit,
      # alert, emerg.
      LogLevel   warn
      ErrorLog  ${APACHE_LOG_DIR}/domain1.com/error.log
      CustomLog ${APACHE_LOG_DIR}/domain1.com/access.log combined
   </VirtualHost>

/etc/apache2/sites-available/domain2 is identical, other than domain2 being
used where domain1 is.

/var/www contains the simple error404.html, and /var/www/htdocs/domain1.com and
/var/www/htdocs/domain2.com each contain a simple index.html, which is just the
usual Apache "It Works" file with "It" replaced by the appropriate domain name.

Thanks,
Craig


Sent - Gtek Web Mail



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 1351904512.9916758@webmail.gtek.biz" target="_blank">http://lists.debian.org/1351904512.9916758@webmail.gtek.biz


Reply to: