Forum Moderators: phranque

Message Too Old, No Replies

.htaccess mod_rewrite help

need help rewriting multiple URLs

         

ccbcreg

5:11 pm on Mar 22, 2004 (gmt 0)

10+ Year Member



i have about 30 urls i am pointing to an IP address. the desired result would be that all URLs (urls-name.com, urls2.com, etc..) get rewritten to the single URL ie www.url-name.com. i have tried several times and some do not work.. some create loops.


RewriteEngine on
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^(.*) http://www.url-name.com/$1 [L,R]

or


RewriteEngine on
RewriteCond %{HTTP_HOST} !^urls2.com(:80)?$
RewriteCond %{HTTP_HOST} !^urls-name.com(:80)?$
RewriteRule ^(.*) http://www.url-name.com/$1 [L,R]

any help would be appreciated.

btw. i know that


UseCanonicalName On

in the httpd.conf

ccbcreg

9:34 pm on Mar 22, 2004 (gmt 0)

10+ Year Member



after a bit of testing i got it...

this works...


RewriteEngine on
RewriteCond %{HTTP_HOST}!^www.url-name.com(:80)?$
RewriteRule (.*) http://www.url-name.com/$1 [L,R]