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

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -