Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Trailing slash, and reference to index.php while following best practice

Status Resolved
Add-on / Version Speedy 1.8.1
Severity
EE Version 7.3.12

Harold Kuiper

Feb 01, 2024

Hello Brian,

Currently, we are in the process of implementing Speedy Redis static cache, and we encountered a minor challenge. It appears that some adjustments were necessary for the implementation to function correctly. I’m reaching out to confirm if these modifications were indeed necessary or if there might be a potential oversight on our part.

Here are the specific issues we encountered:

1. We had to modify the reference to the file loaded with **`require_once`** in the created **`index_redis_default_site.php`** at line 46. My assumption is that this adjustment aligns with the best practices recommended by EE, as outlined in the [ExpressionEngine documentation](https://docs.expressionengine.com/latest/installation/best-practices.html).
In our case we wanted to reference the correct index.php.
2. We’re using a trailing slash in our URLs (**`{url_title}/`**), we observed that the statically cached version only appeared when the slash was removed from the URL (**`{site_url}/{url_title}`**). To address this, we considered removing the trailing slash from the cache key, as shown in the code snippet below:

// Remove the trailing slash from the key
    if (substr($key, -1) == '/') {
        $key = substr($key, 0, -1);
    }

 

Our existing setup seems to be operating smoothly, and we’re able to identify the correct key and retrieve the cached response in our development environment. Despite this, I wanted to check in to confirm that we haven’t overlooked any potential issues or opportunities for enhancement

If you have any insights or suggestions, your guidance would be greatly appreciated.

Kind regards,
Wiebe

#1

BoldMinded (Brian)

Hello there. I don’t plan on making any changes based on how Speedy sets the cache keys in regards to the trailing slash. Speedy aside, I would actually recommend not using the trailing slash because that is not what EE expects, and from personal experience on a larger EE site not even using Speedy, the trailing slash ended up causing a lot more problems then it solved.

If you have to remove the require_once, then it sounds like something is loading your index file twice, which I can’t help with because it sounds like some sort of routing, custom config setup, or something else custom with your environment that might be causing that.

Login to reply