Hi,
I am trying to switch over to Caddy from Apache. I currently have the following in my Apache .htaccess file:
RewriteCond %{REQUEST_URI} ^/category/(.*)
RewriteRule ^category/(.*)$ https://%{HTTP_HOST}/categories/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/tag/(.*)
RewriteRule ^tag/(.*)$ https://%{HTTP_HOST}/tags/$1 [R=301,L]
Essentially what it is doing is it is redirecting all /category/$1 traffic to /categories/$1 and all /tag/$1 traffic to /tags/$1.
I was reading the documentation for Caddy redir and rewrite, but I’m not quite sure how to accomplish the task because both require exact matches on the source.
I also tried this:
rewrite {
if {uri} match ^/category/(.*)
r ^category/(.*)$
to /categories/{1}
}
Am I missing something obvious? Preferably I’d like to have a 301 redirect so search engines know that /category/ and /tag/ has permanently moved to their plural alternative.
Please let me know.
Thanks,