0

I am developing a Concrete5 website:

  • Concrete5 is an open source PHP CMS
  • It is hosted on my VPS (Debian 6, Apache 2.2.16 and PHP 5.4)
  • This is the development-url : http://www.test.mijn-teamuitje.nl/
  • It uses the default .htaccess generated by Concrete5

My issue is with the .htaccess rules and is related to this : mod_rewrite 'add path info postfix:'

The issue causes any url with index.php and trailing slashes to go all 404 on me. so this works : http://www.test.mijn-teamuitje.nl/teams But this DOESN't : http://www.test.mijn-teamuitje.nl/index.php/teams

I however managed to fix this with one line:RewriteRule ^index.php/(.*)$ index.php [L,DPI] in the .htaccess so now it does work and there is no 404.

Unfortunately there is one downside, and this is the issue : any url mapped to the Concrete5 'tools' path takes like 15 seconds to load and I just can't figure out why. These tools-urls load dynamic resources like html or javascript outputted by the server. An example is this one:http://www.test.mijn-teamuitje.nl/index.php/tools/required/alert.php. When you open a page, these urls are called in the background with script or link elements. The page loads instantly but the resources take forever.

I know this is complicated but if anyones knows, just from looking at my rewriterules, why this could be an issue then I'd love to hear about it.

These are my rewriterules from the .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php\/(.*)$ index.php [L,DPI]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php
</IfModule>

This is the default htaccess from Concrete5 wich normally always works. The line containing the DPI-flag is the one I added.

Judging from the mod_rewrite logs there is no recursive redirect going on. These are the lines for url http://www.test.mijn-teamuitje.nl/index.php/tools/required/alert.php

83.84.100.81 - - [16/Jul/2014:16:49:04 +0200] [www.test.mijn-teamuitje.nl/sid#7fe14d27a518][rid#7fe14d4f0b70/initial] (3) [perdir /var/www/nl.mijn-teamuitje-test/] add path info postfix: /var/www/nl.mijn-teamuitje-test/index.php -> /var/www/nl.mijn-teamuitje-test/index.php/tools/required/alert.php
83.84.100.81 - - [16/Jul/2014:16:49:04 +0200] [www.test.mijn-teamuitje.nl/sid#7fe14d27a518][rid#7fe14d4f0b70/initial] (3) [perdir /var/www/nl.mijn-teamuitje-test/] strip per-dir prefix: /var/www/nl.mijn-teamuitje-test/index.php/tools/required/alert.php -> index.php/tools/required/alert.php
83.84.100.81 - - [16/Jul/2014:16:49:04 +0200] [www.test.mijn-teamuitje.nl/sid#7fe14d27a518][rid#7fe14d4f0b70/initial] (3) [perdir /var/www/nl.mijn-teamuitje-test/] applying pattern '^index\\.php\\/(.*)$' to uri 'index.php/tools/required/alert.php'
83.84.100.81 - - [16/Jul/2014:16:49:04 +0200] [www.test.mijn-teamuitje.nl/sid#7fe14d27a518][rid#7fe14d4f0b70/initial] (2) [perdir /var/www/nl.mijn-teamuitje-test/] rewrite 'index.php/tools/required/alert.php' -> 'index.php'
83.84.100.81 - - [16/Jul/2014:16:49:04 +0200] [www.test.mijn-teamuitje.nl/sid#7fe14d27a518][rid#7fe14d4f0b70/initial] (3) [perdir /var/www/nl.mijn-teamuitje-test/] add per-dir prefix: index.php -> /var/www/nl.mijn-teamuitje-test/index.php
83.84.100.81 - - [16/Jul/2014:16:49:04 +0200] [www.test.mijn-teamuitje.nl/sid#7fe14d27a518][rid#7fe14d4f0b70/initial] (1) [perdir /var/www/nl.mijn-teamuitje-test/] initial URL equal rewritten URL: /var/www/nl.mijn-teamuitje-test/index.php [IGNORING REWRITE]

Any help would be very much appreciated, I've be going at this all day now !

Community
  • 1
  • 1

2 Answers2

0

Instead of trying to disable all PATH INFO, you can do it for only calls not for the tools?

RewriteRule ^index\.php/(?!tools) index.php [L,DPI]
Jon Lin
  • 142,182
  • 29
  • 220
  • 220
  • Unfortunately no, because then the tools-urls will result in 404 and they return javascript, css or html snippets. So the tools urls need to work too. – Justin van Schaick Jul 16 '14 at 16:39
0

I'm closing this question. There was nothing wrong with the rewrite rule. Apache was just buggy, probably because I (improperly) installed PHP 5.4 on Debian6. I installed Debian 7 which solved my issues.

The usage of the DPI flag in my question is correct, try if if you are experiencing trouble with PATH_INFO.