Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!



Photo
- - - - -

301 Redirection Problem


  • Please log in to reply
7 replies to this topic

#1 Hic

Hic

    HR 3

  • Members
  • PipPipPip
  • 93 posts

Posted 20 December 2009 - 11:40 AM

Hi ..

I'm sorry I couldn't apply any of the methods described in the pinned thread .. every time I get "This webpage has a redirect loop." or "Internal server error".

I'm just trying to redirect a subdomain:
subdomain.domain.com to subdomain.domain.com/blog .. I need a permanent 301 redirection ..

nothing worked, any assistance will be appreciated.

Thanks

#2 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 20 December 2009 - 12:50 PM

Do you have anything else in your .htaccess file currently? Without any of the details it sounds like something may be conflicting. Also, how is the subdomain set up currently? Does it simply alias to the subdirectory location, and is there any redirection scheme set up there?

We'll probably need more details to help if there are conflicting rules somewhere.

On a typical *nix/Apache system you can usually use something like

CODE
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/blog/$1 [R=301,L]


#3 Ron Carnell

Ron Carnell

    HR 6

  • Moderator
  • 968 posts
  • Location:Michigan USA

Posted 20 December 2009 - 01:33 PM

secret.gif Psst, Randy. In your code, I think you want to change www.domain to subdomain.domain?

#4 Hic

Hic

    HR 3

  • Members
  • PipPipPip
  • 93 posts

Posted 20 December 2009 - 01:49 PM

Thank you Randy for answering, yes it seems like an old redirection is conflicting ..


QUOTE(Ron Carnell @ Dec 20 2009, 01:33 PM) View Post
secret.gif Psst, Randy. In your code, I think you want to change www.domain to subdomain.domain?



That's what I did actually reading the pinned article and it's not working ..

What I did now (and it worked) is taking advantage of the technology thumbup1.gif
I just found an option in the cpanel and it redirected the domain using one click .. But I'm not sure if it's a permanent 301 redirection, but it seems to be (it have to be actually) ..

Thanks a lot.

#5 Hic

Hic

    HR 3

  • Members
  • PipPipPip
  • 93 posts

Posted 21 December 2009 - 10:04 AM

Here is what cpanel did .. added a .htaccess in the root folder with this code


CODE
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain.domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.subdomain.domain.com$
RewriteRule ^/?$ "http\:\/\/subdomain\.domain\.com\/blog\/" [R=301,L]



#6 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 21 December 2009 - 10:35 AM

hysterical.gif Man I must have been out of it yesterday when I read this one, because I completely missed the point. I actually didn't want subdomain.domain.com in there Ron because I thought I read it was going to the www.domain.com/blog location. Besides doing the subdomain.domain.com on every request would most definitely cause an infinite loop.

Hic: The stuff cPanel did would give it a 301 if the redirect actually works. I'm just not sure why in the world they're backslash escaping some characters in the RewriteRule, which doesn't need to be done, and more importantly why they're not backslash escaping the dot characters in the RewriteCond lines that should be escaped. Nor can I figure out why they're allowing both the www and non-www version of the subdomain url to be live. Ideally you should pick one or the other.

That said, I'd do it a bit differently, assuming the entire site sits under the /blog subdirectory.

CODE
RewriteCond %{HTTP_HOST} ^www\.subdomain\.domain\.com [NC]
RewriteRule (.*)$ http://subdomain.domain.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !^/blog
RewriteRule (.*) http://subdomain.domain.com [R=301,L]


#7 Ron Carnell

Ron Carnell

    HR 6

  • Moderator
  • 968 posts
  • Location:Michigan USA

Posted 21 December 2009 - 11:06 AM

QUOTE
Besides doing the subdomain.domain.com on every request would most definitely cause an infinite loop.

You're right. See, I didn't read it closely enough to catch that. embarrassed.gif

Should we just start taking Sundays off?


#8 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 21 December 2009 - 05:52 PM

Well, I did for the most part this week. Cept for cooking a turkey for my mom's Christmas that is always the Sunday before the day. That's what I'll blame it on. I was tired from being up early to start the bird. giggle.gif

Other than that, my body would probably go into shock if I started taking all of every Sunday off. Not that I work all that hard any day of the week mind you. wink1.gif




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

We are now a read-only forum.
 
No new posts or registrations allowed.