Jump to content

Redirect Root Breaks Subdomain

Recommended Posts

I use my domain primarily to host a blog, which is located in http://foo.com/blog/. I use a redirect from http://foo.com/ to http://foo.com/blog/. Everything works great with this until I add a subdomain. When I access the subdomain http://subdomain.foo.com/, that also redirects to http://foo.com/blog/.


The redirect rule I'm using is one I created through the cPanel wizard:


>RedirectMatch temp ^/$ http://foo.com/blog/


How can I redirect root to a folder without breaking subdomains?




Edited to add: BTW, I'm certain it's the redirect rule that's causing the problem. When I remove the root-to-folder redirection, subdomains work just fine.

Edited by joefish

Share this post

Link to post
Share on other sites

Try replacing the RedirectMatch in .htaccess with the following:


>RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?foo.com$ [NC]
RewriteRule ^$ /blog/

Edited by click

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...