Common scripts


 

1. Update PHP version through .htacess

You need to insert a rule into your .htaccess file to update PHP version. This file is hidden by default so to be able to see it, you should tick the Show Hidden Files option inside your File Manager > Settings.
Then navigate to the desired folder and select the .htaccess file. If there isn’t one, you can go ahead and create a new one. Once it is selected, right click on it and select Code Edit.

Now paste the following lines at the top of your file as follows:

#5.6
<IfModule mime_module>
AddHandler application/x-httpd-ea-php56___lsphp .php .php5 .phtml
</IfModule>

Ref: k-1.com.pk hosted on smart.ideaservers.net started working with the above code.

Alternatively, Hostgator PHP version (.htaccess) file download

#5.6
<IfModule mime_module>
AddHandler application/x-httpd-php56 .php .php5 .php4 .php3
</IfModule>

#7.0
<IfModule mime_module>
AddHandler application/x-httpd-php70 .php .php5 .php4 .php3
</IfModule>

#7.1
<IfModule mime_module>
AddHandler  application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>

#7.2
<IfModule mime_module>
AddHandler application/x-httpd-ea-php72 .php .php5 .phtml
</IfModule>

#7.3
<IfModule mime_module>
AddHandler application/x-httpd-php73 .php .php5 .php4 .php3
</IfModule>

#7.4
<IfModule mime_module>
AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>


2. Auto Redirect http:// to https://

Add the following script in .htaccess file.

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]