You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chirouze Olivier <ol...@volvo.com> on 2007/03/22 14:26:18 UTC

RE: [users@httpd] Re: Question about mod_rewrite

Hi Jean-Philippe,
 
Took me time to answer as well...
It becomes pretty weird if this is working on another machine.
If your browser queries for cookies this is not because of Apache but
related to your web application.
Do you use mod_usertrack?
Can you provide a full log? If it logs 20 attempts it might mean that
your pointed server (thenewwebsite) does a HTTP redirect and end up in
an endless loop.

Olivier

Olivier CHIROUZE
I&0 Infrastructure 
Volvo Information Technology 

 


________________________________

	From: Jean-Philippe Battu [mailto:jeanpba@gmail.com] 
	Sent: 25 February 2007 19:29
	To: users@httpd.apache.org
	Subject: [users@httpd] Re: Question about mod_rewrite
	
	
	Hi Olivier and httpd users !
	
	Sorry for my delay of replying since my last post. Thanks
Olivier 
	for your answer ! In my configuration, I use RewriteEngine
	to on when I try to setup this configuration
	I tried to change the RewriteRule from (.+) to .+
	
	and to add [P] (In this case I needed to set up proxy pass
	but the result is still the same
	
	for this configuration:
	        <IfModule mod_rewrite.c>
	                RewriteEngine On
	                RewriteCond %{HTTP_REFERER}
^http://incoming_web_site*\.html
	
	                RewriteRule (.+) http://thenewsite.com
	                RewriteLog
/usr/local/apache2052/logs/rewrite_vh9p.log
	                RewriteLogLevel 9
	        </IfModule>
	
	 
	the redirection seems to work, thenewsite.com is written in my
browser but
	this brower tells me to activate cookies and in the access
logfile, the attempt
	is repeated 20 times.
	
	On another machine, with the same operating system (FC4) and the
same web server
	(apache 2052), it works fine !
	
	
	Cheers
	
	Jean-Philippe Battu
	
	 
	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 <http://www.theanotherpage.com/>
[P]
	 
	
	Olivier CHIROUZE
	I&0 Infrastructure 
	Volvo Information Technology 
	
	 
	
	
	________________________________
	
		From: Jean-Philippe Battu [
	mailto:jeanpba@gmail.com <ma...@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
<http://www.theforeignwebsite.com/*%5C.html>  
		                RewriteRule  (.+)
http://www.theanotherpage.com <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


Re: [users@httpd] Problems passing form data outside the root

Posted by matt farey <ma...@gmail.com>.

Mark Crosby wrote:
> Regarding this error, I'm still having the same problem.
>
> I've visited the httpd room on IRC and posted in several forums.
>
> Here is the page I'm having problems with:
> http://www2.specialistagencyservices.co.uk/sections/needwork/test.php
>
> It links to a script that shows the variables produced by this form:
>
> <?
> echo $firstname, $surname;
> ?>
>
>
> I'm stuck - Any ideas?
>
>
>
>
> ----- Original Message ----- From: "Mark Crosby"
> <mc...@speedygeek.co.uk>
> To: <us...@httpd.apache.org>
> Sent: Thursday, March 22, 2007 2:38 PM
> Subject: [users@httpd] Problems passing form data outside the root
>
>
>> Hi Folks!
>>
>> I've hunted high and low for a solution for this, to no avail.
>>
>> I have a standard http form on a page on my website which passes data
>> to a php script to add data to mysql.  The problem is it doesn't get
>> the data. I'm having the same problems with scripts that need
>> authentication such as username/password, as the username/password
>> doesn't get passed to the next page.
>>
>> Scripts do pass data if in the root directory of the website, but not
>> in sub directorys.
>>
>> I'm using Apache with CentOS 4 (RHEL4).  Theres nothing in the log
>> files.
>>
>> Any help would be much appreciated as I've hunted high and low for
>> the answer to this, and no one knows the answer.
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>

this is probably not an apache config error, unless you are removing the
handler in certain directories, or unless you have some weird cgi based
php setup with cgiscripting only in the root.

Run php as a module,
dont save your php files with BOM, (although you can save in utf-8)
dont use short tags

<? echo "hello world"; ?>
instead use
<?php echo "hello" world"; ?> for maximum portability

globals should be off, so that when posting or using
url?firstname=hello&lastname=world

<?php
echo $firstname, ' ', $lastname;
?>

should not result in anything at all being printed to screen,

instead use the following notation

<?php
echo $_GET['firstname'], ' ', $_GET['lastname'];
?>
or


<?php
echo $_POST['firstname'], ' ', $_POST['lastname'];
?>

depending on the method your form employs which should be post for any
action which does more than retrieve data.


-- 
Matthew Farey




---------------------------------------------------------------------
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] Problems passing form data outside the root

Posted by Mark Crosby <mc...@speedygeek.co.uk>.
Regarding this error, I'm still having the same problem.

I've visited the httpd room on IRC and posted in several forums.

Here is the page I'm having problems with: 
http://www2.specialistagencyservices.co.uk/sections/needwork/test.php

It links to a script that shows the variables produced by this form:

<?
echo $firstname, $surname;
?>


I'm stuck - Any ideas?




----- Original Message ----- 
From: "Mark Crosby" <mc...@speedygeek.co.uk>
To: <us...@httpd.apache.org>
Sent: Thursday, March 22, 2007 2:38 PM
Subject: [users@httpd] Problems passing form data outside the root


> Hi Folks!
>
> I've hunted high and low for a solution for this, to no avail.
>
> I have a standard http form on a page on my website which passes data to a 
> php script to add data to mysql.  The problem is it doesn't get the data. 
> I'm having the same problems with scripts that need authentication such as 
> username/password, as the username/password doesn't get passed to the next 
> page.
>
> Scripts do pass data if in the root directory of the website, but not in 
> sub directorys.
>
> I'm using Apache with CentOS 4 (RHEL4).  Theres nothing in the log files.
>
> Any help would be much appreciated as I've hunted high and low for the 
> answer to this, and no one knows the answer.
>
>
> ---------------------------------------------------------------------
> 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


[users@httpd] Problems passing form data outside the root

Posted by Mark Crosby <mc...@speedygeek.co.uk>.
Hi Folks!

I've hunted high and low for a solution for this, to no avail.

I have a standard http form on a page on my website which passes data to a 
php script to add data to mysql.  The problem is it doesn't get the data. 
I'm having the same problems with scripts that need authentication such as 
username/password, as the username/password doesn't get passed to the next 
page.

Scripts do pass data if in the root directory of the website, but not in sub 
directorys.

I'm using Apache with CentOS 4 (RHEL4).  Theres nothing in the log files.

Any help would be much appreciated as I've hunted high and low for the 
answer to this, and no one knows the answer.


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