I would like to start redirecting all /index.php pageviews to / to clean up GA data and otherwise simplify URL hits.

Does anyone foresee this causing any problem when using tracking parameters?

E.g. www.domain.com/?stay=1 | www.domain.com/?ref=adwords

Should these be ok?


I use URL parameters like that in some cases. I've never had a problem with it. All browsers seem to support it fine.

  • Yes it is absolutely fine - you are simply requesting the URL / on the domain, instead of e.g. /index.php – DisgruntledGoat Jul 3 '13 at 13:22

Although in most cases that works, it relies on a specific configuration of Apache, which may happen to not be set or be in a different order and then the expected behaviour would fail. It also relies on not having other index file mentioned on the DirectoryIndex before the .php file.

DirectoryIndex determines which files and in which order the server is going to look for when a directory is requested, which is what happens when you end the URL's path with '/'.

It is usually configured like this, more or less:

DirectoryIndex index.php index.html

Which tells the server to look for the file index.php if a directory is requested, if it is not found, then look for index.html and so on if you add more options to that line. But if instead of that, you had this

DirectoryIndex index.html index.php

And you had an index.html file, the expected behaviour would fail because the server would look find index.html and it will pass the query string to that file, which doesn't know what to do with it.

An example:

Let assume that you make this request



DirectoryIndex index.php index.html

tt results in this next URL to be used for the server


but if you had

DirectoryIndex index.html index.php

the request would be


So, the safe way to do things is to add the file you want to work on the URL, or add that directive to your .htaccess file, or be sure that you don't have any other file with common name on the same folder, like index.html

Of course I'm talking about Apache, but it could be any other server that has similar behaviours and directives.

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.