Showing posts with label Apache. Show all posts
Showing posts with label Apache. Show all posts

Thursday, May 6, 2004

How to set up a virtual host in Apache?

Add below to httpd.conf


ServerAdmin admin@testhost.com
DocumentRoot /home/apache/share/htdocs/hostedsites
ServerName www.testhost.com
ErrorLog /home/apache/logs/error/hostedsites/error_log
TransferLog /home/apache/logs/access/hostedsites/access_log

Friday, April 16, 2004

How to redirect URL in Apache.

Two methods using apache configuration.
1. Mod_alias module
The Redirect directive maps an old URL into a new one. The new URL is returned to the client which attempts to fetch it again with the new address
Redirect /service http://foo2.bar.com/service

2. Mod_rewrite module
The Apache server’s mod_rewrite module gives you the ability to transparently redirect one URL to another, without the user’s knowledge
RewriteEngine on
RewriteRule ^old\.html$ new.html