Within Craft, I am renaming the top-level entry URL format for a section from legacy-subdirectory/{slug}
to new-subdirectory/{slug}
. How do I redirect traffic from the legacy URL to the new format within Craft?
I am aware that I may use the rewrite rule within .htaccess
in exchange for a slight performance hit:
RewriteRule ^legacy-subdirectory/(.*)$ /new-subdirectory/$1 [R=301,NC,L]
I would prefer handling this within Craft. As there is only one slug in which I need the redirect, I would prefer handling this without plug-ins.
.htaccess
is going to be much faster than going through Craft/PHP because Apache already knows about the redirect before it passes it off to PHP. If you want speed up your site further, ditch your.htaccess
and move whatever is in there to your vhost configuration and setAllowOverride
toNone
in the server's main config.