1

Just installed EE 2.8.1, haven't renamed the system folder yet and am trying to set up the htaccess file to remove index.php from URLs. When I use the htaccess code recommended in the installation instructions, I get an internal server error. The error log gives an alert:

.htaccess: RewriteRule: cannot compile regular expression '(.?)index\.php/(.*)'\n

Here's the .htacess contents

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

Anyone run into this and know how to fix it?

It's on an Apache 1.3.4 server; fresh install, no addons.

1

The htaccess setting depends of the characteristics of the server. I encountered the same problem too on a Apache server, the htaccess model from the doc was not working properly. You could try this one:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /


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


RewriteCond %{REQUEST_URI} ^/() [NC,OR] 
RewriteCond %{REQUEST_URI} ^/(member|P[0-9]{2,8}) [NC]
RewriteRule (.*) /index.php/$1 [L]

</IfModule>

Else if it's not working try to contact the administrator of the server.

| improve this answer | |
  • It is working fine? – Stéphane May 21 '14 at 13:40
  • Thanks for responding, Stephane. The htaccess code you provide does not trigger the internal server error, and I can also just comment out that particular line in the original one from the docs so that it works. But what I'd like to do is to achieve the same effect, as described here. – Paula May 21 '14 at 14:34
0

After playing around with this, finally landed on the code that works...and oh so simple in the end. In the first Rewrite rule, just remove the question mark in the (.*?). So here's the full code, in case it'll save someone else some time. Straight from the EE docs, with the slight modification. Just remember to replace "syst

<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>
| improve this answer | |
  • Each server could have it's own configuration. I spent many hours solving the .htaccess problem. One of the EE official doc was not working fine: 10 sec to download a very basic page. I'm using htaccess-maker (devot-ee.com/add-ons/htaccess-maker), it give a good performance. I tried about 10 or 15 .htaccess models, the performance was very bad. – Stéphane May 22 '14 at 20:07

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.