No matter what I try, I can't seem to successfully remove index.php. I'm wondering if the host is lacking some setting in the server environment... otherwise the site hosts just fine.

Here's what I've done:

-- Made an .htaccess file containing nothing but the supported method


<IfModule mod_rewrite.c>
    RewriteEngine On

    # Removes index.php from ExpressionEngine URLs
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]

-- Cleared the "Name of your site's index page" field in General Configuration

-- In system/expressionengine/config/config.php, I've tried setting the $config['uri_protocol'] to each of the alternate configurations.

I'm running EE 2.6.1. Can't seem to figure out what's going on, at all.

The only thing I can think of is that I'm running from an IP address type URL, e.g. http://xx.xx.xxx.xx/~sitename, but I don't see why that would affect anything.

Thanks to ALL who take a stab at the answer - this is driving me a little bonkers.

  • "xx.xx.xxx.xx/~sitename" - I'm pretty sure that's your issue. I think I've had the same problem and couldn't get it to work on that temporary URL. You could try editing your local host file so that you bypass the temp URL and have a "proper" url? Jun 5 '13 at 22:29
  • Please, try this: RewriteRule ^(.*)$ /index.php?$1 [L]
    – Sobral
    Jun 5 '13 at 23:05
  • 2
    I think that you need to set the RewriteBase to the user directory used in the temporary address: RewriteBase /~sitename/
    – Dylan
    Jun 6 '13 at 2:12
  • Who are your hosts? It may help in discovering some specific hosting information which may be the cause of the problem.
    – Ian
    Jun 10 '13 at 10:19
  • Setting it to RewriteBase /~sitename/ was the answer! Thank you! (Don't know why this didn't occur to me.)
    – Rob Butz
    Jun 10 '13 at 15:46

As Dylan mentioned, set a RewriteBase, or modify "/index.php" to something like "/~sitename/index.php"

  • Ding ding! :) Fantastic, this works. Thank you PL.
    – Rob Butz
    Jun 10 '13 at 15:45

What actually happens when you do this? You said it doesn't work, but do you see 404 pages, white screens, what?

One thing you could try is changing this line:

RewriteRule ^(.*)$ /index.php/$1 [L]

to this:

RewriteRule ^(.*)$ index.php/$1 [L]
  • hey Adrian, thanks. It actually generates a hard 404 error, bypassing the EE error setting, when it's "not working." I also forgot to mention that I tried index with and without the leading slash. (Sorry for these careless omissions, I'm usually more detailed than this.) The solution below was the answer.
    – Rob Butz
    Jun 10 '13 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.