How to manage multiple domains on same server
.htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about domains, apache, htaccess, , .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :I have more than one (4 to be exact) domains and only one server host with same ip. How I can run all my domains from same server. All websites are wordpress sites.
If you are running Apache on your web server then you should use Name-Based Virtual Hosting, which is explained in the Apache Documentation.
I use the following code in the htaccess file to manage my wordpresses with multiple domains all pointing to the same site (though this isn't wordpress specific).
RewriteEngine On
RewriteCond %HTTP_HOST !^www.yourdomain.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
Basically this redirects any domain that isn't yourdomain.com to yourdomain.com.
This way you avoid any crossdomain violations (with embedded fonts for example), all your sites are accessible from all domains but you only have a single root domain so far as users, bookmarks and search engines are concerned.
You may also want to read this google webmaster blog on canonical urls.
Comments
Post a Comment