Skip to content

trailingslash redirect

Mustafa Uysal edited this page Nov 17, 2018 · 1 revision

Powered Cache checks URL for trailing slash since version 1.2. If the requested path doesn't end with the slash, it forwarded to WordPress. So, WordPress can perform the canonical redirect if needed. However, if you want to do canonical redirection on the web server (apache/nginx) you can add redirection rules below;

Apache:

RewriteCond %{REQUEST_URI} !\.[^./]+$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /$1/ [R=301,L]

Nginx:

rewrite ^([^.]*[^/])$ $1/ permanent;
Clone this wiki locally