GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   How do you do this with .htaccess? (https://gfy.com/showthread.php?t=1013245)

Jakez 03-07-2011 04:44 PM

How do you do this with .htaccess?
 
Let's say I am receiving traffic from a URL with various ID #'s attached to it:
http://www.referrer.com/?id=101

Andthe traffic is going to:
http://www.site.com

How do I have the .htaccess grab the ID from the referrer and do a quick redirect or something so that it will send the visitor to this instead:
http://www.site.com/?ref_id=101

livexxx 03-07-2011 05:38 PM

how about a little bit of php, that would be easy and more controllable for v

Jakez 03-07-2011 05:46 PM

Quote:

Originally Posted by livexxx (Post 17964230)
how about a little bit of php, that would be easy and more controllable for v

That's what I'm currently doing, but it likes to take forever to finally get to the page and it's probably hurting my bounce rate. htaccess seems to be a lot faster.

woj 03-07-2011 05:58 PM

you are probably doing something wrong, it shouldn't take long time to load at all when done in php....

takaya 03-07-2011 06:21 PM

try this one

RewriteEngine on
RewriteRule ^/?(.*) http://www.site.com/ [R=301,L,QSA]

Jakez 03-07-2011 06:22 PM

Quote:

Originally Posted by woj (Post 17964268)
you are probably doing something wrong, it shouldn't take long time to load at all when done in php....

Would it slow it down much if I'm doing an htaccess redirect and then another one in PHP? Kinda another reason why I just want to have it all in htaccess. I have htaccess redirecting mysite.com/string to mysite.com/page.php, so that I can change the htaccess at any time and have it redirect many links at once to where ever I want, then mysite.com/page.php grabs the ID query from the referrer and redirects to mysite.com/page.php?ref_id=101

woj 03-07-2011 06:25 PM

Quote:

Originally Posted by Jakez (Post 17964305)
Would it slow it down much if I'm doing an htaccess redirect and then another one in PHP? Kinda another reason why I just want to have it all in htaccess. I have htaccess redirecting mysite.com/string to mysite.com/page.php, so that I can change the htaccess at any time and have it redirect many links at once to where ever I want, then mysite.com/page.php grabs the ID query from the referrer and redirects to mysite.com/page.php?ref_id=101

need to do it all at once, either all in php, all or all in .htaccess... 2 separate redirects are not a good idea...

takaya 03-07-2011 06:36 PM

Quote:

Originally Posted by takaya (Post 17964303)
try this one

RewriteEngine on
RewriteRule ^/?(.*) http://www.site.com/ [R=301,L,QSA]

This shit will append query string to site.com. It works on my end

Chris 03-07-2011 06:38 PM

wrong thread .. edit.

Jakez 03-07-2011 06:41 PM

Quote:

Originally Posted by takaya (Post 17964331)
This shit will append query string to site.com. It works on my end

I tried but it didn't seem to work. I probably have too much crap going on with this for that to work correctly idk.

I did manage to get what I need all in 1 with the following:
RewriteRule ^string/?_(.*)$ http://www.site.com?id=$1 [QSA]

So site.com/string_101 will now goto site.com/?id=101, didn't know I could dynamically add zone ID's in Juicy :)

fris 03-07-2011 06:42 PM

Quote:

Originally Posted by Jakez (Post 17964129)
Let's say I am receiving traffic from a URL with various ID #'s attached to it:
http://www.referrer.com/?id=101

Andthe traffic is going to:
http://www.site.com

How do I have the .htaccess grab the ID from the referrer and do a quick redirect or something so that it will send the visitor to this instead:
http://www.site.com/?ref_id=101

Code:

RewriteEngine on
Options +FollowSymLinks
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?referrer\.com/ [NC]
RewriteCond %{QUERY_STRING} ^id=([^&]+)$
RewriteRule ^(.*) http://site.com/?ref_id=%1 [L]

this should work.

fris 03-07-2011 09:13 PM

tested it on a site, works fine

Dappz 03-07-2011 09:21 PM

i use this .htaccess to secure my sites :)


All times are GMT -7. The time now is 07:40 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc