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.

2 Answers 2

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 !

Sign up to request clarification or add additional context in comments.

3 Comments

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.
try this .. RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^(.+)$ index.php/$1 [L]
did you rename the htaccess.txt file to .htaccess?
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]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.