Mobile app version of vmapp.org
Login or Join
Lengel546

: Create a filter to consider http://example.com/foo/bar as http://example.com/index.php/foo/bar I'm using URL rewriting to make my url http://example.com/foo/bar/ to http://example.com/index.php/foo/bar.

@Lengel546

Posted in: #GoogleAnalytics

I'm using URL rewriting to make my url example.com/foo/bar/ to example.com/index.php/foo/bar.
I'm not linking the index.php/.. url anywhere, but for some reasons, some users arrives to the index.php url.

In Google analytics, I have a lot of duplicates that are quite annoying to follow up the traffic.

I've watched the Advanced filters but I'm struggling to make it works fine.

Any regex and google analytics pro to help me out ?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Lengel546

3 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

If you have a rewrite rule to rewrite TO the index.php script when "index.php" isn't in the URL, you can have another rewrite rule to redirect away from it when "index.php" is in the URL. I asked on StackOverflow about the mechanics of doing this. You need to use an environment variable with such rewrite rules to prevent infinite loops. Your two rewrite rules would need to look something like this:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index.php
RewriteRule (.*) /index.php/ [L,E=LOOP:1]

RewriteCond %{ENV:REDIRECT_LOOP} !1
RewriteRule ^index.php(/.*)$ [R,L]

10% popularity Vote Up Vote Down


 

@Rambettina238

You've got the right idea using the advanced filter. If you want to remove the index.php from all entries you should use this:

Remove index.php from Analytics URL's

Google Analytics Advanced Filter 1 www.customclicks.co.uk/_images/pages-resource-articles/google-analytics-advanced-filter-1.png
Alternatively, if you want to add the index.php to all entries:

Google Analytics Advanced Filter 2 www.customclicks.co.uk/_images/pages-resource-articles/google-analytics-advanced-filter-2.png
You can read this article for more information

10% popularity Vote Up Vote Down


 

@Mendez628

How do you know it's a web visitor (as in a human). You will often find that these results are masked by robots and crawlers! Just because you're linking the page within your site today doesn't mean that you didn't in the past (which could be indexed by a search engine or even on a forum or similar) doesn't mean it can't be found.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme