I have my hosting for site.com (public_html). On my hosting I have also site2.com which is in public_html/site2. I want to create subdomain.site2.com that has the content of public_html/site2/subdomain. How can I do this? When someone visit site2.com/subdomain he should be redirected (301) to subdomain.site2.com. Some help? Thank you in advance for any reply!
Try this one. RewriteEngine On Options +FollowSymLinks RewriteBase / RewriteCond %{http_host} ^site.com [nc] RewriteRule ^(.*)$ http://www.site.com/$1 [L,R=301] RedirectMatch 301 ^/subfolder/(.*)$ http://subdomain.site.com/$1 Code (markup):
Ok, I added this line: RedirectMatch 301 ^/subfolder/(.*)$ http://subdomain.site.com/$1 Code (markup): ... to public_html/site2. and now it works. When I go to site2.com/subdomain/ I get redirected to subdomain.site2.com. Great! The problem now is that it doesn't load anything! I have a software that should start the install process when I visit the page, but nothing. Error loading the page. Maybe I should see if something is wrong in cPanel?