Forum Moderators: phranque

Message Too Old, No Replies

301 redirect domain with hyphen

just checking to make sure I got it right.

         

Lorel

10:03 pm on Jul 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I just moved a client to a new host. I've set up 301 redirects multiple times but this is the first one with a hyphen. I assume we need a backslash before the hyphen --the same with before a period. It works fine. I just want to make sure this won't cause a problem elsewhere as I couldn't find instructions for this on the internet.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^widget\-keyword\.com
RewriteRule ^(.*)$ http://www.widget-keyword.com/$1 [R=301,L]

[edited by: jdMorgan at 4:57 am (utc) on July 8, 2006]
[edit reason] De-linked [/edit]

jdMorgan

4:57 am on Jul 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No need to escape "-" in this case as it is not a regular-expressions token unless it is part of a character group range specification (e.g. you'd need to escape it in a square-bracketed character group like "[a-z0-9\-]" but not outside of such a group).

Jim