How to set up a 301 Permanent Redirect using .htaccess
Asked by Olivia · · 2338 views
How to Redirect Old URL to NEW using .htaccess
For eg: RedirectPermanent
http://www.domain.com/old-file.html to http://www.domain.com/new-file.html
0
0
1 Answer
Redirect individual files
Redirect 301 /oldfile.htm /newfile.htm
To redirect one specific file to another domain such as example.com/oldfile.htm
to example.net/newfile.htm
:
Redirect 301 /oldfile.htm https://example.net/newfile.htm
Redirect an old domain to a new domain
Code in the example.com domain’s .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ https://example.net/$1 [L,R=301,NC]
1
0
Please login or create new account to participate in this conversation.