Page 1 of 1

[solved] mod_rewrite parked domains

Posted: Wed Jun 13, 2012 12:53 pm
by crankshaft
Hi all;

I have tried without success probably half a dozen times in the last few weeks, to get all of the parked domains to rewrite to the same domain uisng .htaccess mod_rewrite, but no matter what I do I am unable to get the domain rewriting to work at all.

The /parent/child rewrite works fine, no problem at all, but no matter what I do, I simply cannot rewrite the parked domains.

Any help would be really appreciated as I have spent soo much time on this, tried so many examples which were supposedly proven and guaranteed to work and made no progress at all !

Here's the .htaccess

Code: Select all

Options -Indexes +FollowSymLinks
Order allow,deny
Allow from All
RewriteEngine on

# Redirect all parked not equal to www.domain.co.uk
RewriteCond %{HTTP_HOST}   !^www\.domain\.co\.uk [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)         http://www.domain.co.uk/$1 [L,R]

# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

Re: mod_rewrite parked domains

Posted: Wed Jun 13, 2012 1:33 pm
by calguy1000
This is NOT a CMSMS issue.

Re: mod_rewrite parked domains

Posted: Wed Jun 13, 2012 1:46 pm
by crankshaft
Hi;

Thanks, but since config.php contains the:

$config['root_url'] parameter

I thought that it might be somehow overriding mod_rewrite, but even if it's not I would really still appreciate help as I am being penalized by google for duplicate content and really have spent a lot of time to try and resolve this myself before requesting help.

If this post should be in some other section of the forum, then please move it.

Many Thanks

Re: mod_rewrite parked domains

Posted: Wed Jun 13, 2012 4:03 pm
by calguy1000
mod_rewrite rewrites INCOMING requests it has nothing to do with generating URLS in html code. That's where CMSMS comes in.

so if you're pointing numerous domains to the same directory, you should use mod_rewrite to rewrite the URLS so that a request for myotherdomain.com gets rewritten to a request for mydomain.com and then CMSMS will work justf fine. And you shouldn't have any duplicate content problems.

CMSMS core is not, and never will handle multi-domain setups. There are third party modules that may have some success in handling some parts of that problem but it is not a CMSMS issue.

Re: mod_rewrite parked domains

Posted: Wed Jun 13, 2012 10:45 pm
by crankshaft
Hi;

Yes, thanks, that's what I have done with mode_rewrite and the reason for the first post:

Code: Select all

# Redirect all parked not equal to www.domain.co.uk
RewriteCond %{HTTP_HOST}   !^www\.domain\.co\.uk [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)         http://www.domain.co.uk/$1 [L,R]
However this is not having any effect, I have around 2 or 3 parked domains which need to be rewritten to the same one domain and are using the rules above, however this rule is having no effect whatsoever and the parked domains are unchanged in the browser's address bar.

The other parent/child rule in the same .htaccess file works just fine ?!