You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jean-Philippe Battu <je...@gmail.com> on 2007/02/14 08:12:37 UTC

[users@httpd] Question about mod_rewrite

hello

I need help and advices about using mod_rewrite

I have some pdf files on my web site
A foreign web site has stored these pdf file on a html file on this foreign
web site
I would like to redirect its requests to another page

so I wrote:
        <IfModule mod_rewrite.c>
                RewriteEngine Off
                RewriteCond  %{HTTP_REFERER}
^http://www.theforeignwebsite.com/*\.html
                RewriteRule  (.+)  http://www.theanotherpage.com
        </IfModule>

But it doesn't work ! When the foreign web site tries to access , the
redirection begins but doesn't finish.
in the access log of my web site, the access is repeated 20 times with a 302
number for the redirect
On IE, an error message is returned, on firefox, it tells me to check the
cookies...

However I tested this configuration on the same apache server (2.0.52) on
another machine and the redirection
works well and it succeded

I tried to specify the redirection code 302 or 301 in the append flag R but
it is the same

Thanks for your help

cheers

Jean-Philippe Battu
Grenoble

RE: [users@httpd] Question about mod_rewrite

Posted by Chirouze Olivier <ol...@volvo.com>.
Hi,
 
First, I supppose that's just a cut/paste mistake, but with
RewriteEngine set to Off, not much will happen.
Second, you might want to play with [P] flag to proxy the request.
Anyway, your last rule is strange: you might try:

RewriteRule  .*  http://www.theanotherpage.com [P]
 

Olivier CHIROUZE
I&0 Infrastructure 
Volvo Information Technology 

 


________________________________

	From: Jean-Philippe Battu [mailto:jeanpba@gmail.com] 
	Sent: 14 February 2007 08:13
	To: users@httpd.apache.org
	Subject: [users@httpd] Question about mod_rewrite
	
	
	hello
	
	I need help and advices about using mod_rewrite
	
	I have some pdf files on my web site
	A foreign web site has stored these pdf file on a html file on
this foreign web site
	I would like to redirect its requests to another page 
	
	so I wrote:
	        <IfModule mod_rewrite.c>
	                RewriteEngine Off
	                RewriteCond  %{HTTP_REFERER}
^http://www.theforeignwebsite.com/*\.html 
	                RewriteRule  (.+)  http://www.theanotherpage.com
	        </IfModule>
	
	But it doesn't work ! When the foreign web site tries to access
, the redirection begins but doesn't finish. 
	in the access log of my web site, the access is repeated 20
times with a 302 number for the redirect
	On IE, an error message is returned, on firefox, it tells me to
check the cookies...
	
	However I tested this configuration on the same apache server (
2.0.52) on another machine and the redirection
	works well and it succeded
	
	I tried to specify the redirection code 302 or 301 in the append
flag R but it is the same
	
	Thanks for your help
	
	cheers
	
	Jean-Philippe Battu
	Grenoble
	
	

---------------------------------------------------------------------
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