Posts in Category: snippets

How to remove .html, .php, etc (extension) from URL?

To remove the .html extension from your urls, you can use the following code in root/htaccess :

NOTE: If you want to remove any other extension, for example to remove the .php extension, just replace the html everywhere with php in the code above.

Read More

.htaccess file useful snippets

If you get 404 page not found error after installation.

In this case your server needs the RewriteBase option to be set. Open the .htaccess file in the main folder and add the following line to it:

The .htaccess should look like this:

If you have installed the application into a sub

Read More

Common .htaccess file Redirects

Below shows common redirects using htaccess file.

The CI .htaccess shouldn’t be in the application folder; it should be in the root of theSubDomain folder. e.g. /public_html/SubDomain/.htaccess

How to redirect all my urls with no extension to end with .php

or

Read More

Redirect non-www to www and HTTP to HTTPS using htaccess

Below snippet shows how to redirect a site from non-www to www (or viceversa) and from HTTP to HTTPS. To be more clear, the configuration will redirect the following host names:

to

I’ll also show a small change to redirect the www to the non-www version, if you prefer the non-www.

To configure

Read More

Redirect non-www to www in .htaccess

Below snippet shows how to redirect a site from non-www to www

or

or

Here’s the correct solution which supports https and http:

 

Read More