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?