We do support Round the Clock 24 x 7 x 365 (+91) 883 012 3924
header-image

L3 Web Hosting Blog

cPanel, Plesk, Wordpress Hosting SSD disk

Check out L3WebHosting blog for tips and in-depth articles on web hosting services !!

Zipping and Unzipping Files on Linux server

Zip, Gz, Tar, bzip2 are compression and file packaging utility on Linux server.

# To Create zip file :

$zip myfiles.zip Foldername FileName

# To extract zip file :

$ unzip myfiles.zip

# Without unzipping .zip file you can View the contents of *.zip file

unzip -l jasper.zip

# Create a new tar archive

tar cvf myfiles.tar Myfolder/

# Extract from an existing tar archive file.

tar xvf myfiles.tar

# Create a *.gz compressed file:

gzip myfiles

# To uncompress a *.gz file:

gzip -d myfiles.gz

# create a *.bz2 compressed file:

bzip2 test.txt

# To uncompress a *.bz2 file:

bzip2 -d test.txt.bz2

How to change my document root folder using an .htaccess file

By default, files of your primary website are loaded from public_html folder.

If you want to load website’s files from Sub Folder instead of public_html folder and do not want Sub Folder name to be appeared as a part of the URL of your website then this post is for you ūüôā

You need to add below code into /public_html/.htaccess file :

RewriteEngine on
RewriteCond %{HTTP_HOST} ^YourDomain.com$ [NC,OR] RewriteCond %{HTTP_HOST} ^www.YourDomain.com$
RewriteCond %{REQUEST_URI} !SubFolder/
RewriteRule (.*) /SubFolder/$1 [L]

// Replace "YourDomain.com" with your actual Domain Name
// Replace "SubFolder" with your Sub Folder name

Please do contact us at esupport@L3webhosting.com if you require any further assistance.

How to redirect www URLs to non-www

You can redirect http://www.yourdomain.com to http://yourdomain.com by setting below code into .htaccess file.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC] RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]

// Replace yourdomain.com with your actual domain/website name.

Please do contact us at esupport@L3webhosting.com if you require any further assistance.

How to redirect non-www URLs to www

You can redirect http://yourdomain.com to http://www.yourdomain.com by setting below code into .htaccess file.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC] RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

// Replace yourdomain.com with your actual domain/website name.

Please do contact us at esupport@L3webhosting.com if you require any further assistance.

How to reset SSH port from WHM

There is an Auto fixer script available to reset the SSH port through WHM.

# Log into WHM control panel with root user.
# Access the following URL to reset SSH configuration settings to default:

http://ServerIPAddress:2086/scripts2/doautofixer?autofix=safesshrestart

// Replace "ServerIPAddress" with your server IP address or hostname.

After executing this script, SSH Port of your server will be reset to its default value which is 22 port.
Now you can access ssh with default port 22.

Please do contact us at esupport@L3webhosting.com if you require any further assistance.

How to Install cPanel/WHM on CentOS 7

Before installing cPanel you need to install Perl on your server.
# To install Perl on your system, login as root and run the following command.

yum -y install perl

# To install cPanel & WHM on your server, run the following command:

cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest

Please do contact us at esupport@L3webhosting.com if you require any further assistance.

Install ImageMagick PHP extension on cPanel server with EasyApache 4

# To install imagemagick on cPanel server you need to enter below commands on shell

yum -y install ImageMagick-devel ImageMagick-c++-devel ImageMagick-perl

# Now we need to install imagemagick PHP extensions for PHP versions 5.4, 5.5, 5.6, 7.0 and 7.1

for phpver in $(ls -1 /opt/cpanel/ |grep ea-php | sed ‘s/ea-php//g’) ; do
printf “\autodetect” | /opt/cpanel/ea-php$phpver/root/usr/bin/pecl install imagick
echo ‘extension=imagick.so’ >> /opt/cpanel/ea-php$phpver/root/etc/php.d/imagick.ini
done

/scripts/restartsrv_httpd

/scripts/restartsrv_apache_php_fpm

Please do contact us at esupport@L3webhosting.com if you require any further assistance.

Redirect website from http to https using .htaccess

First you need to install a valid SSL certificate for your website and ensure it is working with https://

You have to locate the .htaccess file for your website you want to apply the redirect to.  

For primary website, it will be located in the public_html folder.

Open .htaccess file using any editor and at the top of the file, copy and paste the following code:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Save .htaccess file.

Now your website will redirect from http:// they will be redirected to https:// SSL website.

Please do contact us at esupport@L3webhosting.com if you require any further assistance.

Redirect website from https to http using .htaccess

You have to locate the .htaccess file for your website you want to apply the redirect to.  

For primary website, it will be located in the public_html folder.

Open .htaccess file using any editor and at the top of the file, copy and paste the following code:

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# Save .htaccess file.

Now your website will redirect from https:// they will be redirected to http://

Please do contact us at esupport@L3webhosting.com if you require any further assistance.