Tag : apache-2

Redirect from www to non www using apache htaccess

Redirect from www. to non www

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

XAMPP – Create subdomain (virtualhost)

Edit Apache Config

The file is located “c:xamppapacheconfextrahttpd-vhosts.conf”:

Add this lines if not already exists:

DocumentRoot C:/xampp/htdocs/
ServerName localhost
ServerAdmin admin@localhost

Then add the following to have “c:xampphtdocssub.domain.com” point to http://sub.domain.com.localhost/:

<VirtualHost subdomain.localhost>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /home/httpd/htdocs/subdomain/
ServerAlias subdomain.localhost

Edit HOSTS File

You can find your HOSTS file in the “C:WindowsSystem32driversetc” directory

Open it up in a text editor, and add the following lines: subdomain.localhost