0

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

Arnab Ray
  • 1
  • 1
  • `Tried all the answers but not working.` what did you try? which answers? Please show your efforts. What are your example URLS expected to write to? – chris85 Jul 29 '17 at 14:31
  • Possible duplicate of [Redirect all to index.php htaccess](https://stackoverflow.com/questions/18406156/redirect-all-to-index-php-htaccess) – localheinz Jul 29 '17 at 14:40
  • "Remove index.php from the display URL" - Have you already done this in your application? – MrWhite Jul 29 '17 at 18:19

1 Answers1

1

Put this in .htaccess file

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