• Resolved mccrodp

    (@mccrodp)


    Hi All,

    I have a WPMU installation working with two unique websites with domains maindomain.com and otherdomain.com

    I have parked domains at maindomain.ie and otherdomain.ie which I want to permanently redirect to the appropriate .com domains above. I want this redirection to also redirect maindomain.ie/about to maindomain.com/about not just to drop the /about and redirect to maindomain.com.

    This works for otherdomain.ie/about redirecting to otherdomain.com/about but not for main domain. Please see my .htaccess file below:

    Options +FollowSymLinks
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^maindomain.ie$ [OR]
    RewriteCond %{HTTP_HOST} ^www.maindomain.ie$
    RewriteRule (.*) http://www.maindomain.com/$1 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^otherdomain.ie$ [OR]
    RewriteCond %{HTTP_HOST} ^www.otherdomain.ie$
    RewriteRule (.*) http://www.otherdomain.com/$1 [R=301,L]
    
    # BEGIN AnyFont
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^images/(.*)\.png$ /wp-content/plugins/anyfont/img.php [L]
    </IfModule>
    # END AnyFont
    
    # BEGIN WordPress
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    # END WordPress

    A second lesser question: why does the above .htaccess (or WPMU in general?) drop the www. after redirection. i.e. – even if I go to http://www.maindomain.com it goes to maindomain.com (this happens for both maindomain and otherdomain)

    Any help is greatly appreciated. Thank you very much in advance.

    Best Regards,
    ~mccrodp

Viewing 2 replies - 1 through 2 (of 2 total)
  • This probably isn’t the most elegant way, but if your parked domain maindomain.ie mapped instead to a server directory, then a .htaccess file in there could do the redirect:

    Redirect / http://maindomain.com/

    By redirecting at directory level (i.e. with a trailing /), this would redirect maindomain.ie/about to http://maindomain.com/about.

    Thread Starter mccrodp

    (@mccrodp)

    Hi dgilmour,

    I knew something wasn’t right about this, was even on to my hosting company before posting here. I tried you’re work around solution above and unfortunately didn’t work I had the same result as previously, the about etc. was being dropped.

    However when I changed it back to the original method documented above, it started working!! My hosting company made some changes trying to solve the problem (I think) and what I did there must have been the equivalent of power cycling, taking in the changes. This is the only half-hearted explanation I have. Either way it is working now…

    Thanks very much for your help and logical work-around.

    Best Regards,
    ~mccrodp

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Parked Domains with .htaccess redirection issues’ is closed to new replies.