.htaccess - redirect page to different domain
I've changed the domain of this blog to a subdomain and I needed to redirect old post to new URL.
On old domain in .htaccess
file I've added rewrite rules.
RewriteEngine On
RewriteRule ^javascript-array-sort https://snippets.slepko.co.uk/javascript-array-sort/ [r=301,l]
Request to https://DOMAIN/javascript-array-sort
will be redirected to https://snippets.slepko.co.uk/javascript-array-sort/
.
r=301
- permanent redirect l
(lowercase l) - last, this is the last rule and stop processing the ruleset