You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Alain Roger <ra...@gmail.com> on 2008/09/15 10:42:57 UTC

[users@httpd] apache httpd.conf and .htaccess

Hi,

as you can read in my signature i run apache 2.2.4 under windows XP SP3 and
i have a stupid question about httpd.conf file.
basic installation of apache 2.2.4 under windows XP generates a httpd.conf
file.
in this default file, AccessFileName does not exist... so i add the
following line:

> AccessFileName .htaccess
>

after in order to all local .htaccess file (from whatever folder i want, i
defined my directory options as following:

> Alias /se_internet/ "L:/Webserver/se/internet/"
> <Directory "L:/Webserver/se/internet/">
>     #Options Indexes MultiViews
>     Options Indexes FollowSymLinks
>     AllowOverride All
>     Order allow,deny
>     Allow from all
> </Directory>
>

under my browser FF3, when i run http://my.IP.address/se_internet/error.html,
instead to redirect me on http://my.IP.address/se_internet/find.html, i get
a nice 400 error message:
Bad Request Your browser sent a request that this server could not
understand.

any idea ?
thanks a lot,

-- 
Alain
------------------------------------
Windows XP SP3
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

Re: [users@httpd] apache httpd.conf and .htaccess

Posted by André Warnier <aw...@ice-sa.com>.
Alain Roger wrote:

Ok, then

1) I think that the subject of your message is not very good, if you 
want to get answers.  Your problem is not really in httpd.conf and 
htaccess, it is a problem with mod_rewrite, and you should say so in the 
subject, to attract the mod_rewrite specialists, of which I am not.

2) I started using mod_rewrite myself last week, so my knowledge about 
it is rather limited.  But I would suggest this :
- forget the .htaccess file for now, and since this is your own test 
server, move the Rewrite lines into http.conf, at the end.
So, at the end of httpd.conf, add :

RewriteEngine on
RewriteLog /path-to-logfile
RewriteLogLevel 9    (to get a logfile with full details)

RewriteRule ^error.html$ find.html [L]

then restart your server, retry your access, and look at the logfile 
/path-to-logfile above.
That's the purpose of the logfile, to help you see what happens.
mod_rewrite will tell you step by step what it does to the original URL, 
up to the resulting URL.

Even not being a mod_rewrite specialist, I would also suggest to modify 
your rewrite rule as follows then :

RewriteRule ^/(.*)/error.html$ /$1/find.html [L]


> Hi Andre,
> 
> ok, basically i'm just testing at home the mod_rewrite module from apache,
> so i took an example from internet.
> basically when i type http://my.IP.address/se_internet/error.html in my
> browser address bar, i should be redirected (apache should rewrite address
> as) to http://my.IP.address/se_internet/find.html.
> 
> is it clearer ?
> 
> to do so, i need to have an .htaccess file where i wrote thi RewriteRule.
> instead of doing so (rewrite address), my browser displays a 400 error
> message :-(
> here are my files:
> 
> # --- httpd.conf ---
> Alias /se_internet/ "L:/Webserver/se/internet/"
> <Directory "L:/Webserver/se/internet/">
>     Options Indexes FollowSymLinks
>     AllowOverride All
>     Order allow,deny
>     Allow from all
> </Directory>
> 
> # --- .htaccess ---
> Options +FollowSymlinks
> RewriteEngine on
> RewriteRule ^error.html$ find.html [L]
> 
> 
> 
>>  under my browser FF3, when i run
>>> http://my.IP.address/se_internet/error.html,
>>> instead to redirect me on http://my.IP.address/se_internet/find.html, i
>>> get
>>> a nice 400 error message:
>>> Bad Request Your browser sent a request that this server could not
>>> understand.
>>>
>>> any idea ?
>>>
>> Hi Alain.
>> Someone might be willing to help, but you are not being very clear about
>> what you want to do, what is supposed to do it, or when..
>> Above you say : instead to redirect me...
>> What exactly is supposed to re-direct what ? the part of your configuration
>> file that you copied does not show anything that should redirect anywhere.
>> Can you provide the whole httpd.conf maybe ?
>>
>> André
>>
>>
>> ---------------------------------------------------------------------
>> 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] apache httpd.conf and .htaccess

Posted by Alain Roger <ra...@gmail.com>.
Hi Andre,

ok, basically i'm just testing at home the mod_rewrite module from apache,
so i took an example from internet.
basically when i type http://my.IP.address/se_internet/error.html in my
browser address bar, i should be redirected (apache should rewrite address
as) to http://my.IP.address/se_internet/find.html.

is it clearer ?

to do so, i need to have an .htaccess file where i wrote thi RewriteRule.
instead of doing so (rewrite address), my browser displays a 400 error
message :-(
here are my files:

# --- httpd.conf ---
Alias /se_internet/ "L:/Webserver/se/internet/"
<Directory "L:/Webserver/se/internet/">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

# --- .htaccess ---
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^error.html$ find.html [L]



>  under my browser FF3, when i run
>> http://my.IP.address/se_internet/error.html,
>> instead to redirect me on http://my.IP.address/se_internet/find.html, i
>> get
>> a nice 400 error message:
>> Bad Request Your browser sent a request that this server could not
>> understand.
>>
>> any idea ?
>>
> Hi Alain.
> Someone might be willing to help, but you are not being very clear about
> what you want to do, what is supposed to do it, or when..
> Above you say : instead to redirect me...
> What exactly is supposed to re-direct what ? the part of your configuration
> file that you copied does not show anything that should redirect anywhere.
> Can you provide the whole httpd.conf maybe ?
>
> André
>
>
> ---------------------------------------------------------------------
> 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
>
>


-- 
Alain
------------------------------------
Windows XP SP3
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

Re: [users@httpd] apache httpd.conf and .htaccess

Posted by André Warnier <aw...@ice-sa.com>.
Alain Roger wrote:
[...]

> under my browser FF3, when i run http://my.IP.address/se_internet/error.html,
> instead to redirect me on http://my.IP.address/se_internet/find.html, i get
> a nice 400 error message:
> Bad Request Your browser sent a request that this server could not
> understand.
> 
> any idea ?
Hi Alain.
Someone might be willing to help, but you are not being very clear about 
what you want to do, what is supposed to do it, or when..
Above you say : instead to redirect me...
What exactly is supposed to re-direct what ? the part of your 
configuration file that you copied does not show anything that should 
redirect anywhere.
Can you provide the whole httpd.conf maybe ?

André


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