Redirecting HTTP to HTTPS in Osclass

If your Osclass site has an SSL certificate and you want to use only the secure version of your site you can redirect traffic to secure version using .htaccess file.

Osclass .htaccess file should look like this when permalinks are active on site:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Now you have to change the above code and add some extra lines to redirect traffic to HTTPS, your code will look like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Two extra lines were added

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

This example is for installation in the root folder if you have osclass installed in a subfolder from your root folder you need to make some changes, so be careful to not copy paste this code on your .htaccess file.

Subscribe
X

Subscribe!

Subscribe to get the latest listings, updates and special offers delivered directly in your inbox.