Forum Moderators: phranque

Message Too Old, No Replies

301 subdomain

         

pennywaltz

1:31 am on Aug 26, 2010 (gmt 0)

10+ Year Member



How does one do subdomain.domain.com as a 301 redirect to [domain2.com...]

This is what I have so far, but it didn't work

RewriteEngine on
Options +FollowSymlinks

RewriteCond %{HTTP_HOST} ^subdomain.domain.com$ [NC]
RewriteRule ^ [domain2.com...] [R=301,L]



Any suggestions on revising this code?

jdMorgan

2:55 am on Aug 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Except for the unescaped literal periods in the RewriteCond pattern, the code is OK, assuming that you want to redirect all requests for any URL-path whatsoever in subdomain.domain.com to the "home page" of domain2.com, and that subdomain.domain.com is defined in your DNS zone file.

So, please define "didn't work," as there are about a million ways things could go wrong and be described that way...

How did you test?
What were the results?
How did those results differ from your expectations?

Jim

pennywaltz

6:58 am on Aug 26, 2010 (gmt 0)

10+ Year Member



So when i type in [calendar.tan-pham.com ]

I get forward to [searchassist.teoma.com ]

This is the code I have
#RewriteEngine On
#RewriteBase /
RewriteCond %{HTTP_HOST} ^calendar.tan-pham.com$ [NC]
RewriteRule ^ https://www.google.com/calendar/b/0/embed?src=tanpiphone@gmail.com&ctz=America/New_York&gsessionid=OK [R=301,L]


So looking at this code, I should be forwarded to Google Calendar.. instead of that searchassist

phranque

9:01 am on Aug 26, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



that was probably your browser redirecting you to a search page when your DNS lookup for that subdomain failed.

jdMorgan

1:49 pm on Aug 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually, it was probably your ISP returning a "redirect" page, because they have a business deal with Teoma.

The implication is that you have not defined the "calendar" subdomain in your DNS zone file, so the DNS lookup is failing. This has nothing to do with your code, because the caledar.tan-pham.com request is never even reaching your server...

Jim