Arnab Ray
Arnab Ray

Reputation: 1

.htaccess removing index.php from URL

Need an htaccess/ mod_rewrite assistance to:

  1. Remove index.php from the display URL
  2. Redirect the non index.php urls to their respective index.php urls without showing index.php
  3. Sometimes there will be url without index.php
  4. The url structure has subfolders after domain and folders after index.php with query string. Tried all the answers but not working.

Example URL:
domain.com/index.php/moduleA/modeuleB?var=1&bvar=2
domain.com/folder/index.php/moduleC/moduleD?var=1&bvar=2
domain.com/folder/index.php/m1/m2/m3/m4/m5

Upvotes: 0

Views: 2232

Answers (1)

vikas kumar Gupta
vikas kumar Gupta

Reputation: 67

Put this in .htaccess file

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

Upvotes: 1

Related Questions