I updated my .htaccess file to redirect an article to the https version of the site. I discovered Apache 301 Redirect not working. The following line, which should work, didn’t. I tried placing the line at the top of the .htaccess file and that still didn’t do the trick.
Redirect 301 /portfolio/old-article/ https://www.newWebSite.com/portfolio/old-article/
Since that didn’t work, I tried a different method. I used Apache’s RewriteEngine to redirect to the https version, see the code below:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^portfolio\/old\-article\/?$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,NC]
By the way, just as a refresher, here’s how you would redirect an entire site to a new url:
Redirect 301 / https://newWebSite.com/