Forum Moderators: phranque

Message Too Old, No Replies

something wrong about my subdomains ( .htaccess )

why is this happening?

         

paulowolf

6:38 pm on Jan 31, 2004 (gmt 0)

10+ Year Member



I have my domain www.example.com.br , and I want when users type blog.example.com.br, or www.blog.example.br, go to www.example.com.br/blog
I'm using this code, on /blog/ :

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?blog\.example\.com\.br$ [NC]
RewriteRule ^(.*)$ http://www.example.com.br/blog/$1 [R=301,L]

but sometimes when I type the address, it don't find the address, go to msn search pages and so...
I tryed to put this on / (site root):

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?blog\.example\.com\.br$ [NC]
RewriteRule ^(.*)$ http://www.example.com.br/$1 [R=301,L]

seems working, but I don't know its right or will work later..

[edited by: jdMorgan at 9:15 pm (utc) on Jan. 31, 2004]
[edit reason] No personal URLs. Please see TOS. [/edit]

paulowolf

6:43 pm on Jan 31, 2004 (gmt 0)

10+ Year Member



I forgot to say.
When it don't find the address (blog. or www.blog.)
I enter to www.example.com.br, or www.example.com.br/blog , and after this most times the subdomains start to work..
I really don't have any idea what's happening...

[edited by: jdMorgan at 9:16 pm (utc) on Jan. 31, 2004]
[edit reason] Examplified URLs. [/edit]

jdMorgan

9:22 pm on Jan 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Paulo,

Welcome to WebmasterWorld [webmasterworld.com]!

sometimes when I type the address, it don't find the address, go to msn search pages

This sounds like two problems. One of which is that your PC has a domain hijacker on it. Try LavaSoft's AdAware, and SpyBot Search and destroy (do a search for them), both free malware removers.

I would also suggest that you do not end-anchor your domain patterns. Just use:


RewriteCond %{HTTP_HOST} ^(www\.)?blog\.example\.com\.[b]br[/b] [NC]

(no "$" on the end)

ALso, remember to flush your browser cache (Temporary Internet Files) every time you test a new rule.

Other than that, your code looks fine. If trouble persists, you may have a DNS problem.

Jim

paulowolf

9:40 pm on Jan 31, 2004 (gmt 0)

10+ Year Member



Now is working fine!
but if stop to work,I'll think is a DNS problem.
how fix it?

(sorry about bad english, i'm brazilian)

jdMorgan

12:13 am on Feb 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Paulo,

How to check your DNS: http://www.rscott.org/dns/

Jim

paulowolf

1:09 am on Feb 1, 2004 (gmt 0)

10+ Year Member



DNS are ok, the problem was fixed removing the $
thanks a lot, my domain seems ok now