Archive

Posts Tagged ‘hostname’

How to redirect non www to www

July 27th, 2011 Comments off

There are still sites you cannot reach without using www in domain name. That is DNS configuration problem, but what if you find that your site is indexed with 2 domain names – one with www.yourpage.com and yourpage.com. For search engines, these are two different sites with the same content.

Non WWW to WWW redirection

#Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^yoursite.com
RewriteRule ^(.*) http://www.yoursite.com/$1 [R=301,L]

If you have any problem please remove “#” from the  first line.

Categories: Hosting Tags: , ,

Prevent hostname from changing after VPS restart

February 12th, 2011 Comments off

Every time I reboot the vps,  it comes as hostname “defaulthostname”. How to prevent this?

1. You can change its hostname with the command ‘hostname
# hostname
without parameter it will output the current hostname.

# hostname your-hostname
will set the hostname of the system to your-hostname


2. Login to SSH as root and navigate to etc/sysconfig then type: chattr +i network.
cd ..
cd etc/sysconfig
chattr +i network

Categories: Hosting, Linux Tags: ,