CodeIgniter Forums
.htaccess redirect depending on refererer - 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: .htaccess redirect depending on refererer (/showthread.php?tid=12305)



.htaccess redirect depending on refererer - El Forum - 10-14-2008

[eluser]pixelknipsr[/eluser]
Hi,

I'd like to redirect users depending on their url referer with .htaccess. I've tried some stuff but it doesn't work.

Here's an example:
http://www.mydomain.com/start/ should redirect to http://www.mydomain.com/start/de.php
and
http://www.fr.mydomain.com/start/ should redirect to http://www.fr.mydomain.com/start/fr.php

That's what I tried so far:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{HTTP_REFERER} http://www.mydomain.com
    RewriteRule ^(.*)$/de.php [L]    
</IfModule>

Can someone help me on this? Smile

cheerio Big Grin


.htaccess redirect depending on refererer - El Forum - 11-22-2008

[eluser]Aken[/eluser]
Try this:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{HTTP_REFERER} www\.mydomain\.com
    RewriteRule ^(.*)$ /de.php [L]
</IfModule>