Jump to content

Recommended Posts

Posted (edited)

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
Posted (edited)

Try replacing the RedirectMatch in .htaccess with the following:

 

>RewriteEngine On

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

Edited by click

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...