2

Using Apache2 installed on windows 7, I use the htaccess configuration below to remove the index.php from codeigniter url:

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

Could someone please tell why the configuration above does not work on ubuntu. I have enable mod rewrite using sudo a2enmod rewrite. Thanks

4
  • possible duplicate of How to remove "index.php" in codeigniter's path Commented Aug 21, 2013 at 19:20
  • No error except I have to add index.php before controller before it can work. example: site.com/login will not work but site.com/index.php/login works. What is weird is that, with the same configuration, site.com/login works perfectly on apache2 installed on windows 7 Commented Aug 21, 2013 at 19:21
  • 1
    Did you change AllowOverride None to AllowOverride All in /etc/apache2/sites-available/default? drupal.org/node/134439 Commented Aug 21, 2013 at 19:26
  • yes I did change AllowOverride None to AllowOverride All, rebooted the server but still the same issue Commented Aug 21, 2013 at 19:28

1 Answer 1

2

This is probably because the ubuntu server is setup to pass PATH_INFO, meaning you don't need the query string. You can probably just remove the ? from your rule and it should work:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
# no query string ----------^
Sign up to request clarification or add additional context in comments.

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.