I have two domains www.domain1.com
and www.domain2.com
, both pointing to the same host. What I want to do is redirect www.domain2.com
to www.domain1.com/domain2
.
I got this code for a .htaccess
from the hosting provider but is giving me a error “500 Internal Server Error” when I install it. What is the problem?
RewriteEngine On
RewriteCond% {HTTP_HOST} ^ [www.] domain1.com $ [NC]
RewriteCond% {REQUEST_URI}! ^ / domain2 / .*
^(.*) RewriteRule / index / $ 1 [L]
Then you don’t want to do it via
htaccess
. You need to use the WordPress MU Domain Mapping plugin.Also see: WordPress 3.0: Multisite Domain Mapping Tutorial
When you get a “500 Internal Server Error” look into the error log of your webserver. There you will find more information what went wrong.
In your case it’s most probably a syntax issue with
.htaccess
directives you wrote. They don’t look properly written to me.For information about
mod_rewrite
please see Module mod_rewrite URL Rewriting Engine (Apache HTTP Server). There you will find how to write each command, how they work, description of parameters etc.For more information about the error log, please see Log Files / Error Log (Apache HTTP Server). It contains valuable information what you wrote wrong in the
.htaccess
file.