CodeIgniter Forums
Handling ?ref="nf" gracefully - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Handling ?ref="nf" gracefully (/showthread.php?tid=35629)



Handling ?ref="nf" gracefully - El Forum - 11-05-2010

[eluser]msteudel[/eluser]
So I had a question, facebook is appending ?ref=nf to my links and it's breaking my links:

e.g. http://domain.com/someUniqueID?ref=nf

Any thoughts on a graceful way to strip that out?

One thought is to add some in the index.php bootstrap, but it'd be cool to be able to use routes ...

Thanks, Mark


Handling ?ref="nf" gracefully - El Forum - 01-09-2011

[eluser]Gnuus[/eluser]
[quote author="msteudel" date="1288995462"]So I had a question, facebook is appending ?ref=nf to my links and it's breaking my links:

e.g. http://domain.com/someUniqueID?ref=nf

Any thoughts on a graceful way to strip that out?

One thought is to add some in the index.php bootstrap, but it'd be cool to be able to use routes ...

Thanks, Mark[/quote]


I would like to know this too, any ideas??


Handling ?ref="nf" gracefully - El Forum - 01-10-2011

[eluser]Gnuus[/eluser]
Nobody?


Handling ?ref="nf" gracefully - El Forum - 01-10-2011

[eluser]Victor Michnowicz[/eluser]
It sounds like some .htaccess may do the trick. Maybe this can help: http://dranger.com/weblog/entry/apache_mod_rewrite_strip_query_string.html


Handling ?ref="nf" gracefully - El Forum - 01-10-2011

[eluser]Ochetski[/eluser]
A regular expression replacing all after ? should help.

Something like this on the htaccess file may do the trick:

Code:
Options +FollowSymlinks
RewriteEngine on

RewriteRule ^(.*)\?.*$ $1 [R]



Handling ?ref="nf" gracefully - El Forum - 01-10-2011

[eluser]Gnuus[/eluser]
Does not work for me, thanks anyway!


Handling ?ref="nf" gracefully - El Forum - 01-10-2011

[eluser]msteudel[/eluser]
I ended putting this in my index.php file:
Code:
if( stristr( $_SERVER['REQUEST_URI'], '?ref=nf' ) ) {
        header( "location: http://" . $_SERVER['HTTP_HOST'] . str_replace( '?ref=nf', '', $_SERVER['REQUEST_URI'] ) );
        exit;
    }



Handling ?ref="nf" gracefully - El Forum - 01-11-2011

[eluser]Gnuus[/eluser]
Thanks, but didn't work for me.

I changed the config from auto to path_info, but now it's not displaying the right page!?

Code:
$config['uri_protocol'] = "PATH_INFO";