I can't get rid of that pesky index.php?p= from my urls.


If I manually remove index.php?p= e.g. http://mysite.com/about/people it works, but then goes back to adding the index.php?p= as soon as I navigate away.

I've tried adding 'usePathInfo' => true, and 'omitScriptNameInUrls' => true, to general.php

PathInfo works, http://mysite.com/index.php/testPathInfo = 'success'

When I add garbage to htaccess I get server error, so htaccess works.

And I have another site with a very similar build on the same server that's working fine.

Is there anything else I can look at?

  • Have you checked to make sure index.php?p= isn't actually present in you siteUrl config variable? May 29 '15 at 9:51
  • I'm using baseUrl with {baseUrl} in Site URL in general settings, and no index.php?p= present.
    – Samsull
    May 29 '15 at 17:28
  • Is this a vanilla Apache install?
    – Brad Bell
    May 29 '15 at 17:36
  • It's on a new VPS and I've added the missing extensions to get Craft up and running. For another site on the exact same server I'm not seeing the rogue index.php
    – Samsull
    May 31 '15 at 12:09
  • If I avoid using the url link e.g. {{ aboutUs.url }} it gets rid of the index.php. For example, this works: <a href="{{ siteUrl }}about-us/{{ aboutUs.slug }}">{{ aboutUs.title }} and this doesn't: <a href="{{ aboutUs.url }}">{{ aboutUs.title }}</a> . It works by splitting up the url with a slug variable.
    – Samsull
    Jun 4 '15 at 13:22

Have you seen this on the Craft site: http://buildwithcraft.com/help/why-index.php ?

  • yes, I've tried this, I mentioned it in my post.
    – Samsull
    Jun 1 '15 at 18:10
  • This post has NOT been answered. I can only find a temporary fix.
    – Samsull
    Jun 7 '15 at 11:08
  • I have the same issue as described here. Stumped.
    – SoHo
    Dec 19 '17 at 16:57

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.