Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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

share|improve this answer
    
Thank you for sharing your experience :) –  Drewdavid Jul 2 '13 at 21:47
    
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

 http://www.example.com/?id=1

with

DirectoryIndex index.php index.html

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

 http://www.example.com/index.php?id=1

but if you had

DirectoryIndex index.html index.php

the request would be

 http://www.example.com/index.html?id=1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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