ubuntu - Apache redirect sub domain to main domain conditionally -


i have 1 domain , sub domain cloud.example.com , example.com.

i need redirect cloud.example.com example.com following condition.

cloud.example.com www.example.com/customers/login  cloud.example.com/<any url>  www.example.com/<any url> 

i have added bellow code in apache config file of cloud.example.com

servername cloud.example.com redirect 301 / https://www.example.com/customer/login 

now cloud.example.com redirecting https://www.example.com/customer/login other pages not working .that redirecting www.example.com/customer/login

how solve issue?

the best way use rewrite rules.

rewriterule ^/$ https://www.example.com/customer/login [r] rewriterule ^/(.+) https://www.example.com/$1 [r] 

dont forget add module , enable rewriteengine


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -