.htaccess redirect a subdomain to a main domain
Let’s say you have a blog on the sub domain blog.codexpedia.com, now you want to move it to the main domain www.codexpedia.com. For example, if people is visiting the url http://blog.codexpedia.com/java/java-merge-sort-implementation/, you want to redirect it to https://www.codexpedia.com/java/java-merge-sort-implementation/
Add this to the .htaccess file and put it in your web root directory of the old subdomian, in this case is blog.codexpedia.com.
RewriteEngine On RewriteCond %{HTTP_HOST} ^blog\.codexpedia\.com [NC] RewriteRule ^(.*) https://www.codexpedia.com/$1 [L,R=301]
Search within Codexpedia
Custom Search
Search the entire web
Custom Search
Related Posts