Results 1 to 2 of 2

Thread: Odd behaviour with mod rewrite

  1. #1

    Thread Starter
    Hyperactive Member Datacide's Avatar
    Join Date
    Jun 2005
    Posts
    309

    Angry Odd behaviour with mod rewrite

    Hi all,

    After extensive searching and trial and error, I finally figured out how to mod my .htaccess file to redirect subdomains to a variable.

    At first glance it works perfectly: ontario.domain.com/1234 redirects to domain.com/?prov=ontatrio&event=1234 without changing the url in the address bar. However, it turns out on a few links, it does change the url in the address bar and I can't figure out why.

    Here's the contents of my .htaccess file:

    Code:
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} www.domain.ca$
    RewriteRule (.*) http://domain.ca/$1 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ([^.]+)\.domain.ca$ [NC]
    RewriteRule ^(.*) http://domain.ca/calendar/?prov=%1&event=$1 [P]
    And these are my subdomains:
    • alberta
    • bc
    • manitoba
    • nb
    • nfl
    • nwt
    • novascotia
    • nunavut
    • ontario
    • pei
    • quebec
    • sask
    • yukon


    aberta, nb and sask change the address in the address bar - any ideas why?
    PHP in your FACE!

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Odd behaviour with mod rewrite

    I don't see anything immediately wrong and don't want to set this up just to test it if I don't have to, so I'll just ask one thing -- any reason you're using force proxy (P flag)? if not, try switching it to [NC,L] (no case, last).

    however, I don't think that would really change anything. you might just need to clear your cache.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width