How to do redirection from subdomain to another one?

caygri

Verified User
Joined
Apr 14, 2016
Messages
34
Hello,

in plesk it's very easy but here I see site redirection and I dont see subdomain only maindomain.
 

EthernetServers

Verified User
Joined
Dec 5, 2020
Messages
22
You could use .htaccess to achieve this, in the directory of the sub-domain in question:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^old\.website\.com$ [NC]
RewriteRule ^ http://new.website.com%{REQUEST_URI} [L,R=301,NE]
 

caygri

Verified User
Joined
Apr 14, 2016
Messages
34
not work this because i need to do demo.test.com to demo.test.com/path

is possible choose the path? it's a laravel script
 

EthernetServers

Verified User
Joined
Dec 5, 2020
Messages
22
To redirect demo.test.com to demo.test.com/path you could use something like:

Redirect 301 / demo.test.com/path
 
Top