Re: [users@httpd] Redirect users trying to access any page on my site to the homepage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try this then:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://192.168.5.230/ [NC]
RewriteCond %{REQUEST_URI} !/index.php
RewriteRule .*    /index.php

----- Original Message ----- 
From: "José Ferradeira" <jferra@xxxxxxxxxx>
To: <users@xxxxxxxxxxxxxxxx>
Sent: Sunday, March 20, 2005 7:30 PM
Subject: Re: [users@httpd] Redirect users trying to access any page on my
site to the homepage


> Tim Burden wrote:
>
> > Why not do an internal redirect?
> > RewriteEngine On
> > RewriteCond %{HTTP_REFERER} !^http://192.168.5.230/ [NC]
> > RewriteRule .*    /index.php
> >
> > Some UAs like spiders will probably just see your home page on all your
URLs
> > though.
> >
> >
> Still the same problem, it goes to an infinite loop.
> I'm getting out of ideas
>
>
>
> > ----- Original Message ----- 
> > From: "José Ferradeira" <jferra@xxxxxxxxxx>
> > To: <users@xxxxxxxxxxxxxxxx>
> > Sent: Sunday, March 20, 2005 6:02 PM
> > Subject: Re: [users@httpd] Redirect users trying to access any page on
my
> > site to the homepage
> >
> >
> >
> >>Noah wrote:
> >>
> >>
> >>>On Sun, Mar 20, 2005 at 10:19:10PM +0000, Jos? Ferradeira wrote:
> >>>
> >>>
> >>>>Bruce Kingsbury wrote:
> >>>>
> >>>>
> >>>>>Jos? Ferradeira wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Hi,
> >>>>>>
> >>>>>>I allways go to an infinite loop with IE and to this message
"exceeded
> >>>>>>redirection limit" with Firefox when configuring mod_rewrite to
> >>>>>>redirect users trying to direct access any page on my site to the
> >>>>>>homepage.
> >>>
> >>>
> >>>[snip]
> >>>
> >>>
> >>>
> >>>>>>/var/www/html/.htaccess :
> >>>>>>
> >>>>>>RewriteEngine On
> >>>>>>RewriteCond %{HTTP_REFERER} !^http://192.168.5.230 [NC]
> >>>>>>RewriteRule /* http://192.168.5.230 [R,L]
> >>>>>>
> >>>>>>What am I doing wrong?
> >>>
> >>>
> >>>You're assuming that HTTP_REFERER is being set when the browser follows
> >>>the redirect; a quick test will verify that doesn't happen (well, not
> >>>with Firefox, anyway). To avoid the loop, you can add the following
line
> >>>after the 'RewriteEngine on':
> >>>
> >>>RewriteCond %{HTTP_REFERER} !^$
> >>>
> >>>This verifies that the referer header is there; if it's not, the
> >>>redirect will not be issued at all. Note that this may /not/ be the
> >>>ultimate effect you're going for. =)
> >>>
> >>>--n
> >>>
> >>
> >>Well, with "RewriteCond %{HTTP_REFERER} !^$" the loop stops but the base
> >>idea doesn't work, it didn't redirect to home page when I direct access
> >>a page on the site. The .htaccess now is like this :
> >>
> >>RewriteEngine On
> >>RewriteCond %{HTTP_REFERER} !^$
> >>RewriteCond %{HTTP_REFERER} !^http://192.168.5.230/ [NC]
> >>RewriteRule /* http://192.168.5.230/ [R,L]
> >>
> >>Any more suggestions?
> >>
> >>Thanks
> >>
> >>-- 
> >>------------------------------------------------------------------------
> >>*CensorNet* <http://ti.theta.pt/censornet/index.php>
> >>Controlo e gestão dos acessos à Internet    *WEBPORT*
> >><http://ti.theta.pt/webport/index.php>
> >>A sua informação sempre On-Line
> >>
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>The official User-To-User support forum of the Apache HTTP Server
Project.
> >>See <URL:http://httpd.apache.org/userslist.html> for more info.
> >>To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
> >>   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> >>For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server
Project.
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
> >    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> > For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> >
> >
>
>
> -- 
> ------------------------------------------------------------------------
> *CensorNet* <http://ti.theta.pt/censornet/index.php>
> Controlo e gestão dos acessos à Internet    *WEBPORT*
> <http://ti.theta.pt/webport/index.php>
> A sua informação sempre On-Line
>
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
>    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux