[solved] Rewrite and Apache 2.4

Having trouble installing serendipity?
Post Reply
neonknight
Regular
Posts: 6
Joined: Mon Mar 14, 2011 4:43 pm

[solved] Rewrite and Apache 2.4

Post by neonknight »

Hello s9y community

So, I have upgraded my server from Debian 7 to Debian 8 - which also includes an update of Apache 2.2 to Apache 2.4.
The rewrite rule processing in 2.4 seems to have changed, therefore all my stylesheet URLs etc pp are no longer rewritten. As a quick fix I had to disable URL rewriting in s9y configuration, but this causes other problems as I have relied on rewrite to work for e.g. internal links.

Yes, I read the FAQ, but "Allowoverride All" doesn't do the trick. I have also gone through these suggestions, to no avail, of course.

mod_rewrite is working, projects with less complicated rewriting are still working as expected.
Any other ideas? Or should I just say good bye to rewrite and manually fix all old links?
Last edited by neonknight on Sun Jul 12, 2015 9:06 pm, edited 1 time in total.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Rewrite and Apache 2.4

Post by Timbalu »

Hmm, I have a 2.4.12 here and did not encounter any problems with mod_rewrite yet.
The Apache changelog just says:
mod_rewrite
mod_rewrite adds the [QSD] (Query String Discard) and [END] flags for RewriteRule to simplify common rewriting scenarios.
Adds the possibility to use complex boolean expressions in RewriteCond.
Allows the use of SQL queries as RewriteMap functions.
Nothing which actually is a strict change to previous behaviour used in S9y, I assume.

In the stackoverflow link they talk about this bug https://bz.apache.org/bugzilla/show_bug.cgi?id=53929 (over a year old though).
Could it be that you rely on this?
neonknight wrote:therefore all my stylesheet URLs etc pp are no longer rewritten
What exactly do you mean. Give us an example, please.

Did you maybe miss the extraordinary change to use "Require all granted" in your global configs? eg

Code: Select all

/etc/apache2/sites-enabled/000-default.conf
<Directory /var/www/html>
    Options Indexes FollowSymLinks MultiViews
    Require all granted
    AllowOverride All
</Directory>
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
neonknight
Regular
Posts: 6
Joined: Mon Mar 14, 2011 4:43 pm

Re: Rewrite and Apache 2.4

Post by neonknight »

Thank you for your reply
Did you maybe miss the extraordinary change to use "Require all granted" in your global configs? eg
absolutely negative, the page itself loads, just URLs which should be rewritten result in a 404 (not found). I'm not getting any 401/403 anywhere. I also have no access restriction rules defined anywhere in my vhost config or .htaccess files. But just to make sure I added a "Require all granted" line to the vhost - no change.
What exactly do you mean. Give us an example, please.
In s9y admin -> Configuration -> Appearance and Options -> URL rewrite
set to "Use Apache mod_rewrite":

The main CSS file is now linked as "<link rel="stylesheet" href="http://www.example.com/blog/serendipity ... 1430057859">" - but it cannot be loaded: "The requested URL /blog/serendipity.css was not found on this server.". Obviously because the rewrite seems to fail, because this file does not exist (and I believe should not exist).

When setting "URL rewrite" to "Disable URL rewriting" the CSS is linked as "<link rel="stylesheet" href="http://www.example.com/blog/index.php?/ ... 1430057859">" which can be loaded without any problem.

This rewriting is also applied to article links, rss feed links, some plugins etc pp...

Sadly I cannot find any clue about failing rewrites in my logs.
neonknight
Regular
Posts: 6
Joined: Mon Mar 14, 2011 4:43 pm

Re: Rewrite and Apache 2.4

Post by neonknight »

aaaah, found the nooby pebkac:
I had my "AllowOverride All" in a Location directive where it doesn't do anything. It obviously should have been in a Directory directive.

However, Apache 2.4 does not necessarly warn you about this - unless you explicitely raise the LogLevel of that vhost, Then suddenly it tells you "AH00114: Useless use of AllowOverride in line 11 of /etc/apache2/..." (no, I'm generally not so happy with Debian 8 default behaviours...)
Post Reply