httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zimmi <zimm...@gmail.com>
Subject Re: [users@httpd] mod_rewrite is ignored or disabled
Date Mon, 29 Jun 2015 09:08:17 GMT
Le 29.06.2015 03:18, James Moe a écrit :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 06/28/2015 03:02 PM, Zimmi wrote:
>> There are in your .htaccess file 2 instructions "RewriteEngine":
>> the first states "on", the second states "off". They are around
>> your rewrite rules, so I try to guess that  you meant to switch the
>> rewrite engine on, do the rewrite, and then switch it off.
>>
>    Yes, that was the idea.
>
>> But, afaik the last instruction wins and disables the rewrite
>> engine: no action and no logging... Remove the second one or
>> comment it, and let us know.
>>
>    Whoo-hoo! The rewrite in .htaccess works.
>    The one in vhosts does not. :-( I removed the "L" flag; it made no
> difference.
>
> - -- 
> James Moe
> moe dot james at sohnen-moe dot com
> 520.743.3936
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2
>
> iEYEARECAAYFAlWQnPcACgkQzTcr8Prq0ZMi3QCghBO8Amz6lH7wjt+CiI2d6dU5
> nwMAn1wjttdXJfG2dGUxl49GIsi1qX5c
> =h/PU
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Hi,

Alright, then it seems we have the first step !

I would say the problem now is that your rewrite in .htaccess *overrides 
*the rewrite in the Directory section of the VHost. See:
https://httpd.apache.org/docs/2.4/en/sections.html#merging

While testing a very similar situation some months ago (but with v.2.2), 
I've noticed that it is not enough to set "RewriteEngine Off" in 
.htaccess , as this will still override all the rules in VHost Directory 
configuration section. You need to completely remove or comment out all 
mod_rewrite instructions in your .htaccess in order to have the ones in 
the VHost Directory section to be applied.

First and simplest thing to try is to put all your rewrite instructions 
in the same container : all in .htaccess or all in VHost Directory 
section (if you chose VHost Directory section, remember to 
remove/comment out *all *instructions from mod_rewrite in the .htaccess 
file).

Later, as from your comment in your VHost config, you want everything 
with SSL, have a look at this page too:
https://wiki.apache.org/httpd/RedirectSSL

You could also try that solution with Redirect for the redirect to SSL, 
and then put all your config in the ssl VHost configuration.

(sorry for last top-post, I'm a mailing list beginner)

Zimmi


Mime
View raw message