4

I'm in the process of migrating my sites to Media Temple.

I need to change the htaccess file and add a '?' to successfully remove the 'index.php' from the URL. Without it I get "No input file specified"

This works.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteRule ^(.*)$ /index.php?/$1 [L]

But i'm also running CE Cache, static caching.

How would I edit the static cache handler to do the same?

#------------------- remove trailing slash -------------------
RewriteCond %{REQUEST_URI} !^/system [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/$ /$1 [R=301,L,QSA]

#------------------- index.php -------------------
#strip index.php from the URL if that is all that is given
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://%{HTTP_HOST}/ [R=301,NS,L,QSA]
#strip index.php/* from the URL
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php/ [NC]
RewriteRule ^index\.php/(.+) http://%{HTTP_HOST}/$1 [R=301,L,QSA]

#------------------- CE Cache Static Driver -------------------
RewriteCond %{REQUEST_URI} !^/system [NC]
RewriteCond %{QUERY_STRING} !ACT|URL [NC]
RewriteCond %{REQUEST_METHOD} !=POST [NC]
RewriteCond %{DOCUMENT_ROOT}/static/ce_cache/242d7a/static%{REQUEST_URI}/index\.html -f [NC]
RewriteRule (.*) /_static_cache_handler.php%{REQUEST_URI}/index\.html [L,QSA]

#------------------- EE -------------------
#rewrite all non-image/js/css urls back to index.php if they are not files or directories
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]
1
  • I had the exact same experience.
    – forrest
    Commented Jan 30, 2014 at 13:47

3 Answers 3

8

This generally has to do with PHP being connected to Apache via FastCGI, rather than mod_php. When this is the case, an extra ? is needed in the rewrites to EE's index.php:

From

 RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

To

RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]
0
0

This did it:

<IfModule mod_rewrite.c>
    RewriteEngine On

    #------------------- remove trailing slash -------------------
    RewriteCond %{REQUEST_URI} !^/system [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]

    #------------------- index.php -------------------
    #strip index.php from the URL if that is all that is given
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
    RewriteRule ^(([^/]+/)*)index\.php$ http://%{HTTP_HOST}/ [R=301,NS,L,QSA]
    #strip index.php/* from the URL
    RewriteCond %{THE_REQUEST} ^[^/]*/index\.php/ [NC]
    RewriteRule ^index\.php/(.+) http://%{HTTP_HOST}/$1 [R=301,L,QSA]

    #------------------- CE Cache Static Driver -------------------
    RewriteCond %{REQUEST_URI} !^/system [NC]
    RewriteCond %{QUERY_STRING} !ACT|URL [NC]
    RewriteCond %{REQUEST_METHOD} !=POST [NC]
    RewriteCond %{DOCUMENT_ROOT}/static/ce_cache/242d7a/static%{REQUEST_URI}/index\.html -f [NC]
    RewriteRule (.*) /_static_cache_handler.php?%{REQUEST_URI}/index\.html [L,QSA]

    #------------------- EE -------------------
    #rewrite all non-image/js/css urls back to index.php if they are not files or directories
    RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]

</IfModule>
2
  • Now only the home page works and I can't get to the control panel. Still having issues. Commented Jul 3, 2013 at 21:59
  • Is your system folder named "system"? If not, change this line to have the name of your system folder: RewriteCond %{REQUEST_URI} !^/system [NC]
    – Jay F
    Commented Sep 1, 2013 at 23:49
0

I also needed to change "system" to the folder that I have renamed for my EE install. That fixed all issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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