Forum Moderators: phranque

Message Too Old, No Replies

Rewrite , redict on /

redict when ppl link to my mysite.com/HOME/

         

Doom

2:14 pm on Mar 1, 2004 (gmt 0)

10+ Year Member



RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://home.example.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.example.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://example.org/.*$ [NC]
RewriteRule .*\.(mp3¦php¦MP3¦jpg¦JPG)$ [example.org...] [R]

This worx fine to for PHP,Mp3,jpg....etc..
but i want to redict:
if some links to my site www.example.org/HOME/ then he will redicted to www.example.com/redict.html

but on my sites..example.org home.example.org , users should not be redicted..

[edited by: jdMorgan at 5:05 pm (utc) on Mar. 1, 2004]
[edit reason] Examplified, fixed spacing [/edit]

jdMorgan

5:17 pm on Mar 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Doom,

Welcome to WebmasterWorld [webmasterworld.com]!

First, let's simplify what's there:


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://home.example.org/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.org/ [NC]
RewriteRule \.(mp3¦php¦jpg)$ http://www.example.org/redict.html [NC,R=301,L]

This worx fine to for PHP,Mp3,jpg....etc..
but i want to redict:
if some links to my site www.example.org/HOME/ then he will redicted to www.example.com/redict.html
but on my sites..example.org home.example.org , users should not be redicted..

To accomplish that, add the following:


RewriteCond %{HTTP_HOST} ^www\.example\.org
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://home\.example\.org/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.org/ [NC]
RewriteRule ^HOME http://www.example.com/redict.html [NC,R=301,L]

If I understood you correctly, that should work.

Jim