Backup using /scripts/pkgacct and Restoring


Log-in to the Server as root


Grep Domain to get the username
--------------------------------------------
[root@server ~]$ grep domainname /etc/userdomains
example

[root@server ~]$ /scripts/pkgacct example



After Full Backup move it to user's public_html so that user can download it
-----------------------------------------------------------------------------------------------
[root@server ~]$ cp cpmove-example.tar.gz /home/example/www/



Give Appropriate Permissions and Assign Ownership
-------------------------------------------------------------------
[root@server ~]$ cd /home/example/www
[root@server www]$ chmod 755 cpmove-example.tar.gz
[root@server www]$ chown example.example cpmove-example.tar.gz



RESTORING PACKAGE
---------------------------
[root@server ~]$ /scripts/restorepkg example

DONE !

.htaccess redirect rules


.htaccess redirect rules


Use below mentioned .htaccess rules as per your requirment.

#// This allows you to redirect your entire website to any other domain
Redirect 301 / http://example.com



#// This allows you to redirect your entire website to any other domain
Redirect 302 / http://mt-example.com/


#//  This allows you to redirect index.html to a specific subfolder
Redirect /index.html http://example.com/newdirectory/



#//  Redirect old file path to new file path
Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html


#//  Provide Specific Index Page (Set the default handler)
DirectoryIndex index.html

Hpe this will help you lot :)

Change main domain to subfolder


Change main domain to subfolder

Use below mentiond .htaccess rule in your document root in order to redirect your main domain to subdomain without changing the url.

=============================================================
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?main\-domain.com$ [NC]
RewriteCond %{REQUEST_URI} !^/sub\-folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /sub-folder/$1
RewriteCond %{HTTP_HOST} ^(www.)?main\-domain.com$ [NC]
RewriteRule ^(/)?$ sub-folder/index.php [L]
============================================================

WEBSERVER

PACKAGES NEEDED FOR CONFIGURATION

httpd

IF THE PACKAGES ARE NOT AVAILABLE INSTALL THROUGH YUM INSTALLER

yum install httpd

THE MAIN CONFIGURATION CAN BE EDITED AS FOLLOWS

vim /etc/httpd/conf/httpd.conf

shift+g==>

<VirtualHost 192.168.0.X:80>
DocumentRoot /var/www/html
ServerName stationX.example.com
</VirtualHost>

PHP handlers for Apache


In this article, I'll explain about the PHP Handlers on Apache Web server which are widely discussed in the context of Hosting Industry. There are two ways to configure Apache to use PHP :

(1) Configure Apache to load the PHP interpreter as an Apache module (DSO)
(2) Configure Apache to run the PHP interpreter as a CGI binary (CGI)


PHP Handlers

A handler is a piece of code built into Apache that performs certain actions when a file with a particular MIME or handler type is called. PHP handlers are the programs that interpret the PHP code in your web application and process it to be sent as HTML (or another static format which the web browser understands) by your web server. None of the major web servers available today can handle PHP by themselves which is why they need another program to do it for them. This program, known as a PHP handler takes all the PHP code and generates the output which is then sent to the web server which forwards it on to the user upon request. Currently there are Four major PHP handlers available on Apache. They are CGI, DSO, suPHP, & FastCGI. Each handler delivers the libraries through different files and implementations. Each file and implementation affects Apache’s performance, because it determines how Apache serves PHP. I will be explaining these handlers one by one from here.

Addon Domain

Addon domain?

The addon domain option within cPanel allows you to host multiple websites/domains under a single cPanel account. You can give e-mail accounts and forwarders for domains added. All analytics are calculated separately.

To create a second domain in your hosting account, please do the following:

Login to your cPanel account and click Addon Domains, under Domains tab. There are Four fields cPanel asks for when creating an Addon Domain.

1. New Domain name

2. Subdomain/FTP username.

3. Document root.

4. Password.

How to Remove an Addon Domain from cPanel

If you have an Addon Domain set up and would like delete it, please do the following:
  1. Login to your cPanel and click Addon Domains.
  2. At the bottom, under Actions, click Remove.
Please note removing the addon domain only removes the domain from the DNS and server configuration. Your files and databases are not deleted or affected by removing the addon domain.


I hope this post will help you lot.

.htaccess error reporting (PHP)

Ihave added below mentioned line in .htaccess file inorder to display PHP error.

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on


In some case you may face some errors like "Internal server error" while adding above lines. In such cases use below mentioned lines in your .htaccess file.

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag  log_errors on
php_value error_log  /home/path/public_html/domain/PHP_errors.log


Hope this will help you  :)