I have built and deployed dozens of Craft sites, so I know how to remove 'index.php' from urls, but now I have a site that refuses to accept my most determined efforts to remove it.

This is the situation:

  • I am using the Craft supplied .htaccess file with the same settings as all of my other sites.
  • Just to be thorough, I added 'omitScriptNameInUrls' => 'true', to the config file
  • double checked all of the general settings in the CP and all is as it should be

After trying a few things, I found that if I use {{ siteUrl }}path I get a clean url, but if I use {{ url('path') }} it leaves that nasty index.php in the url. The same is true for {{ entry.url }}. One last bit of puzzlement - if I manually enter a full path, e.g. http://sitename/news it works fine

I suspect I am missing something obvious, but it is definitely driving me nuts!

2 Answers 2


This recently tripped me up. 'true' (with quotes) is not the same as true (without the quotes).

Lose the quotes in the config file, clear Craft's caches, and it should stick.

Also make sure your siteUrl is the same as what your web server is configured as. If you have a redirect in there, say www.example.com goes to example.com, and your siteUrl is configured to use the former, that seems to trip up Craft's check too.

  • 1
    Thanks, that was it! I knew it was something stupid on my part, guess I need to take more frequent breaks. Much appreciated!
    – Roi Agneta
    Commented Sep 2, 2017 at 19:32
  • Mark it correct if you'd like. ;) Commented Sep 2, 2017 at 23:05

Have you tried everything here? https://craftcms.com/support/remove-index.php

  • Yes - as I said, doing this is nothing new for me
    – Roi Agneta
    Commented Sep 1, 2017 at 21:35

Your Answer

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

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