HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=4)
-   -   URL with and without www (http://www.howtoforge.com/forums/showthread.php?t=46108)

bhwong 24th May 2010 11:06

URL with and without www
 
Hi,

If I add a site and put my domain as www.domain.com, domain.com will not go to my website but to ISPConfig's "It's works!" page. If I change my domain to domain.com, www.domain.com will not go to my website but to ISPConfig's "It's works!" page.

So how do I make sure that both domain.com and www.domain.com go to my website instead of ISPConfig's "It's works!" page?

BorderAmigos 24th May 2010 20:11

In ISPConfig3 > Sites > Web Domain... Domain: yourdomain.com, Auto-Subdomain: www.

If you want to redirect then with mod_rewrite installed and enabled put one of these in your .htaccess file...

To direct all www.example.com to example.com
Code:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /
  RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$ [NC]
  RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
</IfModule>

To direct all example.com to www.example.com
Code:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /
  RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC]
  RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
</IfModule>


bhwong 25th May 2010 03:40

Thanks! It's working. :)


All times are GMT +2. The time now is 08:20.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.