Answer the question
In order to leave comments, you need to log in
Redirecting from subdomain to domain using .htaccess
Hello! Please tell me how you can redirect from a subdomain to the main domain using .htaccess. There is a subdomain1.mysite.com subdomain, you need to transfer the user from this subdomain to mysite.com/index.php?action=1 but the subdomen1 address should remain in the address bar. mysite.com.
Answer the question
In order to leave comments, you need to log in
Redirect http://subdomen1.mysite.com http://mysite.com/index.php?action=1 RewriteEngine on RewriteBase / RewriteRule ^ http://subdomen1.mysite.com$ http://mysite.com/index .php?action=1
Unfortunately, this method does not work. Mod Rewrite redirects to the main page of mysite.com
I would be very grateful if you tell me how best to do this in order to fulfill all the conditions set
you need to get into the apache config and for your virtual host do this <virtualhost> ServerName domain.com ServerAlias subdomain.domain.com # ... </virtualhost>
hosting usually has such an option - site aliases. for example, you create domain.com, you are asked for aliases, the most common is www.domain.com. add one or more to it. by the way, www is just a subdomain
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question