CodeIgniter3 .htaccess removing index.php subdomain

Below is the general documentation for editing the .htaccess file to remove index.php from a url

The documentation examples is
will be the same as

using .htaccess file of:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

However, I tend to use a lot of subdomains of the format

To remove index.php from a subdomain is a bit different, you need to add an additional line to .htaccess

RewriteBase /website1/


RewriteBase /website2/

The .htaccess file should be:

RewriteEngine On
RewriteBase /SUBDOMAIN/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Another interesting Codeigniter Project I found last weekend was

I was having some issues with the controller not finding the libraries i put in the third_part folder.  I had the include path correct to the library and it worked on my localhost but wouldn’t work on the server.  I couldn’t figure out the issue and instead used the above project and that worked with no issues on localhost and the server.

This entry was posted in Coding, Web and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s