Welcome Guest, Not a member yet? Register   Sign In
removing querystring using htaccess
#1

[eluser]Jonas G[/eluser]
As I was asking this question i found the answer myself. I thought i would share in case someone finds it useful:

I don't rely on querystrings in my app, but many web services might link to your site and append a querystring. Eg.
Code:
http://example.com/somepage?utm_source=twitterfeed&utm_medium=twitter

You can remove this using htaccess. My htaccess file now goes:
Code:
RewriteEngine On
RewriteBase /

RewriteCond %{QUERY_STRING} .
RewriteRule (.*) http://www.example.com/$1? [R=301,L]

RewriteCond $1 !^(index\.php|img|js|css|assets|facebox|favicon\.ico|robots\.txt)
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

RewriteCond $1 !^(index\.php|img|js|css|assets|facebox|favicon\.ico|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

I hope someone finds this usefull...
#2

[eluser]Unknown[/eluser]
You have helped me, this is exactly what I was looking for. On Facebook apps, links that you include in wall posts add ?rf=nf, which tells you that the referrer was the newsfeed, but this made me get a 404. Here's a forum post where someone tries to tell this to a Facebook Platform Team Admin: http://forum.developers.facebook.com/vie...pid=193167

Anyway, this worked great, thank you!




Theme © iAndrew 2016 - Forum software by © MyBB