Hi, I am trying to figure out a way to rewrite multiple versions of a domain name and redirect to a single domain using .htaccess. I would like to rewrite http://domain.com, www.domain.com and domain.com (including a trailing slash if entered) to http://www.domain.com/. I basically need a rule to match everything preceding the domain.com and redirect to http://www.domain.com/. I was able to do this by creating a new rewrite condition for each version but I'm sure there is a simpler way based on my experience with PHP's regexp function rules. I have tried multiple tutorials and searched these forums but I can't seem to get this to work so any help is appreciated.
Place this above every rewrite rule you have: RewriteCond %{HTTP_HOST} ^domain\.com$ RewriteRule ^(.*)$ http://www.domain.com/$1 [QSA,L] Code (markup):
How do I redirect from ?id=33, I would normally use something like : RedirectMatch permanent ^/how_to_hypnotize_someone.php$ http://www.site.com/how_to_bewilder_someone.htm Code (markup): But I've converted an asp site and want to redirect all my old site.net/?id=33 type urls to my new article.html type urls and the above method doesn't want to play?