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)
-   -   .htaccess question...how do you do this? (https://gfy.com/showthread.php?t=667598)

jollyperv 10-18-2006 04:44 AM

.htaccess question...how do you do this?
 
I want to do a simple redirect from one URL to another, but only want it to redirect if the traffic is coming from 1 particular URL.

Possible with .htaccess?

gooddomains 10-18-2006 04:55 AM

yes, it is, httpd.apache.org is your place to read

TheSwed 10-18-2006 04:57 AM

use this tool
http://www.affiliateprogramslocator...._generator.php

beta-tester 10-18-2006 05:00 AM

it is possible. Google for answer...
the idea is: test if the site is the one you want traffic redirected if it comes from that site, redirect traffic (301 redirection is the best method).

jollyperv 10-18-2006 05:03 AM

Thanks guys, been googling around a bit, but trying to word it for a search is tough.

quantum-x 10-18-2006 05:05 AM

.htaccess
-----------------------
Redirect permanent /old-dir http://www.domain.com/new-dir/
-----------------------

or


.htaccess
-----------------------
Redirect permanent /old-file.html http://www.domain.com/new-file.html
-----------------------

jollyperv 10-18-2006 05:06 AM

Nah, that's not what I'm trying to do. I want to redirect traffic from only 1 particular URL that is not mine.

tenletters 10-18-2006 05:10 AM

Code:

<script type="text/javascript">
if(document.referrer.indexOf("www.where-traffic-is-coming-from.com") != -1)
{
location.href = "http://www.site-to-send-traffic.com/";
}</script>

it's not htaccess and must be put on each page but it works.

jollyperv 10-18-2006 05:13 AM

Quote:

Originally Posted by tenletters (Post 11102064)
Code:

<script type="text/javascript">
if(document.referrer.indexOf("www.where-traffic-is-coming-from.com") != -1)
{
location.href = "http://www.site-to-send-traffic.com/";
}</script>

it's not htaccess and must be put on each page but it works.

Nice, thanks I'll try that :thumbsup

quantum-x 10-18-2006 05:15 AM

oh right, that'd be........

.htaccess
----------------
RewriteEngine On
rewritecond %{http_host} ^http://(www\.)?target-site\.com
rewriteRule ^(.*) http://www.final-site.com/$1 [R=301,L]
------------------

Should do the trick
where 'target site' is the incoming site

quantum-x 10-18-2006 05:16 AM

Quote:

Originally Posted by jollyperv (Post 11102054)
it's not htaccess and must be put on each page but it works.

It's not a 301 redirect. SE traffic is lost, not to mention bunches of non JS users.

jollyperv 10-18-2006 05:18 AM

Thanks again guys, the javascript thing doesn't seem to be working, gonna try the htaccess.

darksoul 10-18-2006 05:20 AM

the right way:

Code:

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www.)?othersite.com.*$ [NC]
RewriteRule .* http://www.google.com [R,L]


quantum-x 10-18-2006 05:24 AM

Quote:

Originally Posted by darksoul (Post 11102100)
the right way:

Code:

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www.)?othersite.com.*$ [NC]
RewriteRule .* http://www.google.com [R,L]


or the perfect way

Quote:

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www.)?othersite.com.*$ [NC]
rewriteRule .* http://www.final-site.com/ [R=301,L]

darksoul 10-18-2006 05:27 AM

Quote:

Originally Posted by quantum-x (Post 11102110)
or the perfect way

lame.
at least the 3rd time you got it better than your previous failed attempts.
The 301 redirect is meaningless unless its redirecting bot traffic.

jollyperv 10-18-2006 05:29 AM

Gonna try that latest one, now another question:

What if the incoming URL is a subdomain, and how would I need to change the (www.) part?

You guys rule :thumbsup

quantum-x 10-18-2006 05:32 AM

Quote:

Originally Posted by darksoul (Post 11102118)
lame.
at least the 3rd time you got it better than your previous failed attempts.
The 301 redirect is meaningless unless its redirecting bot traffic.

Quoth apache manual:

Quote:

DESCRIPTION: In some cases the same web site is accessible by different addresses, like domain.com, www.domain.com, www.domain2.com and we want to redirect it to one address.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R,L]
fuck man, sorry to use code you don't understand.
cram it.

darksoul 10-18-2006 05:32 AM

you can use (.*) instead of www

darksoul 10-18-2006 05:35 AM

Quote:

Originally Posted by quantum-x (Post 11102134)
Quoth apache manual:



fuck man, sorry to use code you don't understand.
cram it.

lol,
you just made a fool out of your self :)
read again genius, HTTP_HOST is your domain and it will never
match the reffering domain.

do you dig it ? or do I have to draw it for you ?

quantum-x 10-18-2006 05:36 AM

Quote:

Originally Posted by darksoul (Post 11102144)
lol,
you just made a fool out of your self :)
read again genius, HTTP_HOST is your domain and it will never
match the reffering domain.

do you dig it ? or do I have to draw it for you ?


sigh. I just woke up.
Still, you can cram your attitude :)

darksoul 10-18-2006 05:36 AM

Quote:

Originally Posted by quantum-x (Post 11102134)
Quoth apache manual:



fuck man, sorry to use code you don't understand.
cram it.

also the shit you posted redirects ALL referrers instead of one.
you got some comprehension problems.


All times are GMT -7. The time now is 07:26 PM.

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