0

I've google a lot but I can't find any rule to remove the index.php from both cases:

  1. domain.com/index.php => domain.com
  2. domain.com/index.php/other/stuff => domain.com/other/stuff

Here is what I've done so far

RewriteRule .* index.php [L]
RewriteCond %{REQUEST_URI}  !(administrator) [NC] #exclude administrator folder
#RewriteRule ^index.php$ /$1 [R=301] #when this is enable work only first case
RewriteRule ^(.*)index.php$ /$1 [R=301,L] #when this is enable work only second case

If I enable both cases all requests are redirected to domain.com

Thanks.

Zara Gheorghe
  • 488
  • 4
  • 13

2 Answers2

0

first make sure that MOD rewrite is ON .

try this code

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

hope this works !

GKS
  • 338
  • 1
  • 10
  • PHP 5.3.28 (cgi-fcgi) (built: Oct 25 2014 13:49:56) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies with the ionCube PHP Loader + Intrusion Protection from ioncube24.com v5.0.6, Copyright (c) 2002-2015, by ionCube Ltd. – Zara Gheorghe Jan 18 '16 at 12:21
  • try this .. RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^(.+)$ index.php/$1 [L] – GKS Jan 18 '16 at 12:22
  • did you rename the htaccess.txt file to .htaccess? – Sphinx Jan 19 '16 at 08:17
0

hope this works !

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|assets|robots\
.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]