ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

htaccess question for server that needs to be forced to use PHP5

July 09, 2012 2:03pm

Subscribe [1]
  • #1 / Jul 09, 2012 2:03pm

    John St-Amand

    865 posts

    HI All - I don’t know too much about htaccess or server setup, so please forgive the relatively simple question…

    I have a client with a hosting environment that by default is not set to use PHP 5. So get get EE 2.5.2 running on the server, I had to use an htaccess file that had simply:

    Action php-cgi /cgi-bin/php5
    AddHandler php-cgi .php

    My question is - with that in the htaccess file, how do i go about adding my usual htaccess rules to remove index.php, etc?  I tried to add my htaccess rules to the end, but I get a 500 server error if i do it that way.  So I suspect there is a proper place in the order that this should be added.  This is what i usually use for htaccess - removing www and removing index.php

    <IfModule mod_rewrite.c>
    
    # Enable Rewrite Engine
    # ------------------------------
    RewriteEngine On
    RewriteBase /
    
    # Redirect www Requests
    # ------------------------------
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    
    # Redirect index.php Requests
    # ------------------------------
    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
    RewriteCond %{THE_REQUEST} !/system/.*
    RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]
    
    # Standard ExpressionEngine Rewrite
    # ------------------------------
    RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]
    
    </IfModule>

    So I’m looking for some guidance from an htaccess guru to tell me how i merge the above lines forcing php5 with my rewrite rules.

    Thanks!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases