Could you please guide me to permanent redirect my website https://example.com/ to new subdomain https://ww1.example.com/

I don't know how to do that. Please help

I'm using vestacp.

I will really appreciate your reply.

  • Do the two have separate document roots or are they served out of the same directory? – Stephen Ostermiller Nov 28 '19 at 17:04
  • 1
    they both have different directories. – alioa Nov 28 '19 at 17:34

Modifying the .htaccess in this way:

RewriteEngine On
RewriteRule (.*) http://new.domain.com/$1 [R=301,L]
| improve this answer | |

Assuming your server is Apache, you need to add 301 redirect to your. htacces file.

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^domain.com [NC,OR] 
RewriteCond %{HTTP_HOST} ^www.domain.com [NC] 
RewriteRule ^(.*)$ http://sub.domain.com/$1 [L,R=301,NC]
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.