0

I am currently developing a website in EE (2.10.3), and everything is working great except one difference between my local version (running on XAMPP) and my staging version on a linux server.

I have written a module that my site makes a call to through ACT id, but this isn't working on the staging site, unless I am currently logged in to the control panel! If I'm not logged in, the request returns a 404 error, with the text "File not found.". If I am logged in, visiting the ACT url will return the correct information.

Just to sanity test that it isn't my module causing the issue, I tried loading a url with some other ACT id, with the same issue. For instance, in my installation, the ACT id for the "Channel" method 'combo_loader' is 4. The url for my local version http://local.example.com/?ACT=4 loads just fine, while the URL for the staging version http://staging.example.com/?ACT=4 returns 'File not found.'! If I log in to the control panel in my staging version, then that url works just fine.

Anyone have any info that can help me debug this?

EDIT: I've narrowed this down a bit. The problem lies in my .htaccess file. Specifically, the section used for Static Cache for the Mustash add-on. If I disable that, things work...

<IfModule mod_rewrite.c>

RewriteEngine on    
RewriteBase /

#################################################################################
# START MUSTASH STATIC CACHE RULES 

# -------------------------------------------------------------------------------
# default_site
# -------------------------------------------------------------------------------

# Exclude image files
RewriteCond $1 !\.(gif|jpe?g|png|ico)$ [NC]

# We only want GET requests
RewriteCond %{REQUEST_METHOD} GET

# Exclude CSS/ACT EE URLs and 'preview'
RewriteCond %{QUERY_STRING} !^(css|ACT|URL|preview)

# Uncomment this if you want to disable static caching for logged-in users
#RewriteCond %{HTTP_COOKIE} !exp_sessionid [NC]

# Remove index.php from conditions
RewriteCond $1 ^(index.php/)*(.*)(/*)$

# Check if cached index.html exists
RewriteCond /chroot/home/example/staging.example.com/html/_cache/stash/static_cache/1/$2/index.html (.*\.(.*))$
RewriteCond %1 -f

# Rewrite to the cached page
RewriteRule ^(index.php/*)*(.*)(/*) /_cache/stash/static_cache/1/$2/index.%2 [L]

# END MUSTASH STATIC CACHE RULES
#################################################################################

# -------------------------------------------------------------------------------
# Officially supported method to remove index.php from ExpressionEngine URLs
# See: http://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html
# -------------------------------------------------------------------------------

# 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 not the last two sections, either. I removed them and the problem persists. The problem only goes away when I remove all that other stuff.

2
  • The first thing I would check is to make sure that the path to the system directory and the site url is correct on the server that behaves weird. – Jim Wyse Apr 21 '16 at 12:10
  • Thanks @jim-wyse, but I'm pretty sure that is correct. – Gary Reckard Apr 21 '16 at 20:04
0

Try changing the index.php redirect of your htaccess file to be

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

Note the ? after index.php

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.