There a number of ways to accomplish a 301 redirect however which solution you use depends on what your end goal is.
Below Are A Few Examples That You Can Follow
This allows you to redirect your entire website to any other domain
RewriteEngine on
RewriteBase / RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
Redirect index.html to a specific subfolder
RewriteEngine on
RewriteBase /
RewriteRule ^index.html$ http://domain.com/newdirectory/ [L,R=301,NC]
Redirect HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NC]
N.B:
You would need to ensure the .htaccess file is places in the root folder, the Web Location, of the Hosting for the domain itself.
If you are looking to redirect from the non-www portion of the domain name to the www part then refer to the following:
https://help.blacknight.com/entries/22934923-Redirect-non-www-record-to-www-record-via-htaccess
Comments
0 comments
Article is closed for comments.