Archive

Archive for the ‘Hosting’ Category

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: ,

htaccess SuPHP php_value _flag php.ini

April 28th, 2010 Comments off

On suphp servers  you should remove the lines from .htaccess file that begin with “php_value” and “php_flag”. You will need to add the settings that you want to use to a file named php.ini and upload php.ini into your public_html directory.

You will need to remove php_value and php_flag from ALL .htaccess files you may have

In .htaccess under public_html, add the following:

suPHP_ConfigPath /home/AccountUserName/public_html
<Files php.ini>
order allow,deny
deny from all
</Files>

In php.ini under public_html add the settings that you want to use:

register_globals = On
post_max_size 6M
upload_max_filesize 6M
max_execution_time 90
max_input_time 90
....
Categories: CMS, Hosting, Linux Tags: , , ,

Awstats report send via email

September 11th, 2009 Comments off

Is it possible to get Awstats to send a monthly report with some basic stats  to Email?

Script to send last months AwStats report to an email address: www.sitepoint.com/forums/showthread.php?t=275042

This scipt will run on a web server with CPanel.  It uses the CPanel  system to log in and get the report page from AwStats for the previous month.

To use this script:

  • change the strings located in the first block of code to match  information for your domain and CPanel account.
  • Install the two script files into a location on your web server outside of the public html area (you don’t want someone accidently seeing the account details).
  • Then set up a cron job to run the php program sometime after the first of the month. The command for the cron job might look like:php -q /home/userid/scripts/stats.php

Based on a script from Ronan Magee (ronanmagee on the SitePoint.com forum)
Modified by David K. Goodwin (dkg2000 on the SitePoint.com forum)

Categories: Hosting Tags: , , , ,