Hi @abhagwani,
Could you check if the issue persists when Permalink Manager is deactivated? The HTML output of your website indicates that WP Rocket plugin is enabled.
The problem you are experiencing is pretty common for some cache plugins. Please check out the below article for more details:
https://permalinkmanager.pro/docs/plugin-settings/how-to-add-remove-trailing-slashes/#7-trailing-slashes-and-cache-plugins
To address this issue you will need to use a patch provided by WP Rocket:
https://docs.wp-rocket.me/article/131-redirection-to-enforce-trailing-slash-on-urls
Best regards,
Maciej
Hi,
After disabling the Permalink Manager plugin, the issue gets resolved.
Also, do you think if I enable the Add Trailing Slashes option from the settings of Permalink Manager the issue will be resolved.
Before I go ahead and implement the solution related to issues caused by WP Rocket Cache plugin, I want to be sure that I have the same issue, just to be sure.
In the meantime I will go through the articles you have shared.
Regards,
Akhilesh
Hi Akhilesh,
In the default state, the plugin uses the built-in settings for the trailing slashes. Enabling “Add Trailing Slashes” should also activate the trailing slash redirect (if it is enabled in “Redirect settings” of my plugin), but it will work only if WP Rocket does not use the same cache container for both URL variants (with and without slash).
Best regards,
Maciej
Oh ok. I understand your point.
So you would suggest to implement both the solutions that you recommended. I’m looking for a solution where the pages do not have a trailing slash after the redirect or for any other page that does not have a redirect.
- https://permalinkmanager.pro/docs/plugin-settings/how-to-add-remove-trailing-slashes/#7-trailing-slashes-and-cache-plugins
- https://docs.wp-rocket.me/article/131-redirection-to-enforce-trailing-slash-on-urls
Also, I wanted to bring to your notice that we are using the RankMath plugin to implement redirects on our website. Do you think that can also be part of the issue ?
Reference – https://rankmath.com/kb/how-to-redirect-to-urls-with-trailing-slash/
Please let me know if you need more information.
Regards,
Akhilesh Bhagwani
Hi Akhilesh,
I do not think that RankMath could interfere with the trailing slashes settings.
I have not checked the codebase of WP Rocket plugin recently, so there is a chance the addressed the issue with dynamic trailing slash redirect and PHP/script caching. If so, enabling “Add Trailing Slashes” and “Trailing Slash Redirect” in Permalink Manager settings should solve the problem.
If not, you will need to use .htaccess redirect rule. If you do not have access to .htaccess file via FTP, you can use the .htaccess editor included with Rank Math to force the trailing slash redirect with redirect rule.
Best regards,
Maciej
Hi Maciej,
Thank you for all the support.
I have resolved the issue by following you recommendations.
Thank you,
Akhilesh Bhagwani