You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by José Ferradeira <jf...@netcabo.pt> on 2005/03/20 22:33:21 UTC
[users@httpd] Redirect users trying to access any page on my site to the homepage
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.
I'm on a test environment, with this configuration, using Fedora Core 2
with Apache 2.0.49-4 :
httpd.conf :
....
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride AuthConfig Options FileInfo
Order allow,deny
Allow from all
</Directory>
....
/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?
Any suggestion ?
Regards
Jose Ferradeira
--
------------------------------------------------------------------------
*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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Redirect users trying to access any page on my
site to the homepage
Posted by José Ferradeira <jf...@netcabo.pt>.
Ok great, now its working, it was my second mod_rewrite script and I was
a little bit confused.
The final script :
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://192.168.5.230/ [NC]
RewriteCond %{REQUEST_URI} !/index.php
RewriteRule .* /index.php [R,L]
Thanks a lot
J Ferradeira
Tim Burden wrote:
>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" <jf...@netcabo.pt>
>To: <us...@httpd.apache.org>
>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" <jf...@netcabo.pt>
>>>To: <us...@httpd.apache.org>
>>>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
Re: [users@httpd] Redirect users trying to access any page on my
site to the homepage
Posted by José Ferradeira <jf...@netcabo.pt>.
Ok great, now its working, it was my second mod_rewrite script and I was
a little bit confused.
The final script :
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://192.168.5.230/ [NC]
RewriteCond %{REQUEST_URI} !/index.php
RewriteRule .* /index.php [R,L]
Thanks a lot
J Ferradeira
Tim Burden wrote:
>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" <jf...@netcabo.pt>
>To: <us...@httpd.apache.org>
>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" <jf...@netcabo.pt>
>>>To: <us...@httpd.apache.org>
>>>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
>>>>
>>>>
>>>>
>>>
>>>---------------------------------------------------------------------
>>>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@httpd.apache.org
>>> " from the digest: users-digest-unsubscribe@httpd.apache.org
>>>For additional commands, e-mail: users-help@httpd.apache.org
>>>
>>>
>>>
>>>
>>--
>>
>>
>
>
>
--
------------------------------------------------------------------------
*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
Re: [users@httpd] Redirect users trying to access any page on my site to the homepage
Posted by Tim Burden <ti...@burden.ca>.
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" <jf...@netcabo.pt>
To: <us...@httpd.apache.org>
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" <jf...@netcabo.pt>
> > To: <us...@httpd.apache.org>
> > 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@httpd.apache.org
> >> " from the digest: users-digest-unsubscribe@httpd.apache.org
> >>For additional commands, e-mail: users-help@httpd.apache.org
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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@httpd.apache.org
> > " from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
> >
>
>
> --
> ------------------------------------------------------------------------
> *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@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
---------------------------------------------------------------------
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Redirect users trying to access any page on my
site to the homepage
Posted by José Ferradeira <jf...@netcabo.pt>.
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" <jf...@netcabo.pt>
> To: <us...@httpd.apache.org>
> 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@httpd.apache.org
>> " from the digest: users-digest-unsubscribe@httpd.apache.org
>>For additional commands, e-mail: users-help@httpd.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> 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@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
--
------------------------------------------------------------------------
*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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Redirect users trying to access any page on my site to the homepage
Posted by Tim Burden <ti...@burden.ca>.
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.
----- Original Message -----
From: "José Ferradeira" <jf...@netcabo.pt>
To: <us...@httpd.apache.org>
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@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
---------------------------------------------------------------------
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Redirect users trying to access any page on my
site to the homepage
Posted by José Ferradeira <jf...@netcabo.pt>.
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Redirect users trying to access any page on my site to the homepage
Posted by Noah <si...@onastick.net>.
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
--
<huey> dd of=/dev/fd0 if=/dev/flippy bs=1024
<huey> ^^^ Making Flippy Floppy
---------------------------------------------------------------------
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Redirect users trying to access any page on my
site to the homepage
Posted by José Ferradeira <jf...@netcabo.pt>.
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.
>>
>> I'm on a test environment, with this configuration, using Fedora Core
>> 2 with Apache 2.0.49-4 :
>>
>> httpd.conf :
>>
>> ....
>> <Directory "/var/www/html">
>> Options Indexes FollowSymLinks
>> AllowOverride AuthConfig Options FileInfo
>> Order allow,deny
>> Allow from all
>> </Directory>
>> ....
>>
>> /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?
>>
>> Any suggestion ?
>
>
> http://192.168.5.230 will redirect to http://192.168.5.230/ .. your rule
> will bounce it back to http://192.168.5.230 again. Try adding a trailing
> slash in both the rewrite condition and rule?
>
>
> ---------------------------------------------------------------------
> 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@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
I tried with the trailing slash also tried this
RewriteCond %{HTTP_REFERER} !^http://192.168.5.230/$ [NC]
But the result is the same, I allways go in to an infinite loop.
Any more suggestions?
--
------------------------------------------------------------------------
*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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Redirect users trying to access any page on my
site to the homepage
Posted by Bruce Kingsbury <zc...@maxnet.co.nz>.
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.
>
> I'm on a test environment, with this configuration, using Fedora Core
> 2 with Apache 2.0.49-4 :
>
> httpd.conf :
>
> ....
> <Directory "/var/www/html">
> Options Indexes FollowSymLinks
> AllowOverride AuthConfig Options FileInfo
> Order allow,deny
> Allow from all
> </Directory>
> ....
>
> /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?
>
> Any suggestion ?
http://192.168.5.230 will redirect to http://192.168.5.230/ .. your rule
will bounce it back to http://192.168.5.230 again. Try adding a trailing
slash in both the rewrite condition and rule?
---------------------------------------------------------------------
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org