Apache


Point subdomain to sub directory with htaccess

Enter the below into the .htaccess file. This will not perform a redirect, but will instead show the content of a sub directory at the specified host below. Modify the subdirectory and host parameters as necessary to fit your needs.

RewriteEngine On
RewriteBase /
 
RewriteCond %{REQUEST_URI} !^/subdirectory/
RewriteCond %{HTTP_HOST} subdomain.mywebsite.com$
RewriteRule ^(.*)$ subdirectory/$1 [L]

New Zend Server CE Install

Things you’ll want to do right away –

Open httpd.conf and change

AllowOverride None

to:

AllowOverride All

On line 212 of your http.conf.

Also un comment line 422 Include conf/extra/httpd-vhosts.conf so it’ll use the external vhosts file.


Apache 2.2 “It works” message – vhost and hosts file

I recently switched from using windows to a mac. With windows, you can structure your hosts file like this

127.0.0.1 localhost
127.0.0.1 test.localhost

However, if you do this and you’re on a mac like me and go to test.localhost, you’ll get a “It works!” message no matter how your vhost is configured. The solution is to structure the hosts file for the IP address on a single line like this –

127.0.0.1 localhost test.localhost