I edited .htaccess as described here http://buildwithcraft.com/help/remove-index.php and added this 'omitScriptNameInUrls' => true, to craft/config/general.php, but it doesn't work.


enter image description here

I also have my .htaccess file set up:

RewriteEngine On # Send would-be 404 requests to Craft RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/(favicon.ico|apple-touch-icon.*.png)$ [NC] RewriteRule (.+) index.php?p=$1 [QSA,L]

This file is inside public folder and I also tried putting in in the directory that contains the public folder.

What happens is this: whether 'omitScriptNameInUrls' => true is added or not, the home displays fine without the index.php, but the internal pages require index.php to display.

The only thing that happens when I add 'omitScriptNameInUrls' => true is that the navigation spits out links without the index.php, and so the navigation breaks.

The good people at Craft said that my site (which is a retooling of the Happy Lager demo site) has been changed to a multi-environment config, which is why my config file looks the way it looks. Not sure if there's anything else that needs to me added to a multi-environment config to get the thing to work.

I have not been able to get any more clarification from Craft about this issue yet.

  • Can you edit the original question to show what your craft/config/general.php file looks like? – Brad Bell Mar 6 '15 at 4:06
  • 1
    Your general.php in your 1st screenshot is right. It should go directly unter the * array and not within you environmentVariables array. See Anna's answer! – carlcs Mar 26 '15 at 15:42
  • How do you load the pages that gets index.php appended? Or do you enter them in the URL bar manually? – carlcs Mar 26 '15 at 23:48
  • The thing in the first screenshot didn't work for me. – MDLG Mar 27 '15 at 23:11

These are the settings I have in place for config.php and .htaccess file.

enter image description here

enter image description here

  • What about the other stuff that's in the config file by default? Should delete it? – MDLG Mar 26 '15 at 15:30
  • My .htaccess file looks just like yours – MDLG Mar 26 '15 at 15:30
  • You add it into the '*' array just as my screenshot shows and as the first image that you added to your question shows. You shouldn't have to delete anything else that comes by default in the config files. – Anna_MediaGirl Mar 26 '15 at 19:33
  • I added it to the * array, see screenshots above... none worked. – MDLG Mar 27 '15 at 23:12
  • Where is this site hosted? – Anna_MediaGirl Mar 28 '15 at 3:55

I'd put money on your .htaccess file. Could be a permissions issue or maybe you misspelled .htaccess when renaming it? (The Craft distro comes without the period.) That's certainly happened to me—it's easy to do that (.htacccess anyone?) and then overlook everything else...

If you're using a recent version of MAMP (and not MAMP Pro), it also gives you a choice of using nginx as the web server—which will kindly ignore .htaccess files. It's possible that choice got checked inadvertently when setting up the document root?

One other longshot is mod_rewrite got disabled somehow, though since it's a common module, it's less likely.

  • Oooofff. .htaccess isn't misspelled. MAMP web server is set to Apache. Where should the .htaccess file be? I tried both inside "public" and inside the directory that contains "public" (i.e. at the same level as "public"). I have not tried to put it inside "craft." There's a an .htaccess file in there that just says "deny from all". – MDLG Mar 28 '15 at 17:57

Solved! I found the answer here: https://stackoverflow.com/questions/7670561/how-to-get-htaccess-to-work-on-mamp

The problem was an Apache config setting. The solution was this:

  1. Went to httpd.conf on /Applications/MAMP/conf/apache

  2. In httpd.conf, found:

Options Indexes FollowSymLinks AllowOverride None

  1. Replaced None with All.

  2. Restarted MAMP servers.

This solved the problem in my local environment. Don't know what will happen when I put my site in a shared server. Also don't really know what that configuration is at all, all I know is it worked.

Note that the configuration line that has to do with .htaccess was NOT the problem. That one was already set to AllowOverride All as it's supposed to.


I had that problem as well. Try adding

RewriteBase /

to just under RewriteEngine On. Worked instantly for me.

  • 1
    This didn't seem to solve the problem. – MDLG Mar 26 '15 at 15:30

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.