0

I'm using the code from the EE user guide:

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

It's working fine but the time loading pages is affected, with index.php the page loading is very fast < 1000ms , removing index.php it's slower (8000-10000ms).

The system folder of the site is one step above the root, the problem of slowness could be have a relation with : RewriteCond %{REQUEST_URI} !/system/.* [NC] ?? How to set the correct path, one step above the root of !/system/.

Thanks,

Stéphane

  • In General Configuration, i set the Name of the site’s index page to blank (empty). – Stéphane Jan 5 '14 at 19:39
1

I tried many .htaccess configurations to remove the index.php, I believed the slow down problem was caused by EE.

This .htaccess config no slow down the load page performance:

RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.php/$1 [L]
0

I would remove that rule completely since it's not necessary as your system folder is above the webroot. May want to simplify your rules as you seem to have unnecessary rules. My typical EE .htaccess is as simple as this (ymmv):

RewriteEngine On

# Removes index.php from ExpressionEngine URLs
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
  • Siebird, thanks a lot for you reply. Your .htaccess works fine, i tried many others ones, and when index.php is removed the time loading pages is quite slower. I don't know really what are the causes, plugins, modules, extension??? The latency is really more bigger when index.php is removed. – Stéphane Jan 5 '14 at 23:36
  • The problems is the .htaccess could depends of the configuration of the server. Htaccess Maker: devot-ee.com/add-ons/htaccess-maker, brought very high performances, pages loads very. All the other solutions i've tested, the performances are very poor or not working. – Stéphane Feb 13 '14 at 19:07
0

The main problem is probably here

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

This bit tells Apache to check every request filename against a file that may or may not exist on the filesystem.

You could use something like this which just does some regular expression comparisons, which should be much faster.

# Exclude root files
RewriteCond $1 !^(favicon\.ico|favicon\.png|index\.php|path\.php|php\.ini) [NC]
# Exclude EE folders
RewriteCond $1 !^(system|images|themes)/ [NC]
# Exclude 3rd party folders
RewriteCond $1 !^(css|js|content)/ [NC]
  • Thanks Alan, I guess the problem is not from htaccess script. I tried many scripts, tips given in Stackechange on EE forum and the result is always the same: without index.php the page load time is strongly slower. With no remove index.php script, the pages load very fast (about 1000ms), else it's 8000ms or more. – Stéphane Jan 6 '14 at 17:24
  • I used the site tools.pingdom.com/fpt, to measure the Website Speed Test. Without to remove index.php the total result is 4.5s. Removing index.php it's 24s!!!! It is not a server problem, it really seems it comes from EE. – Stéphane Jan 6 '14 at 18:34
0

I had the same problem, and simply adding this line immediately after RewriteEngine On sped it up:

RewriteRule ^$ /index.php [L,R=301]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.