Forum Moderators: phranque
of course with the needed canonicalization and redirects in order to avoid duplicate issues (f.e., parked.com should not match example.com).
hope was clear...
Is it possible?difficult?
Yes. Of course you can do that.
Serve www.one.com from /user/public_html on server.
Serve www.two.com from /user/public_html/subsite folder on server.
Also set up a redirect so that requests for http://www.one.com/folder/ are redirected to http://www.two.com/ to avoid Duplicate Content issues.
You need to be clear that URLs on the web, and filepaths on the server, are two different things and you can map them any way that you like.
If you want to use the domain then host it properly, with the DNS pointing directly to the server, and not to some "parking service" in the middle.
Jim
My host requires a shameful fee to do that:
I already tested my site and if I remove the canonicalization redirect it runs fine just as I would: no slowness or other related issue.
So I only should adjust some redirections in order to canonicalize both domains and to get them operating for different sites avoiding duplicate issues:
I would that example.com is canonicalized and rests example.com.
parked.com is canonicalized and matches example.com/sub/
example.com doesn't match parked.com.
Parked.com doesn't match example.com.
How can I start getting this?
Thanks
I edited canonicalization redirect in this way:
Original rule
RewriteCond %{HTTP_HOST}!^www\.example\.net
RewriteRule (.*) http://www.example.net/$1 [R=301,L]
My edit
RewriteCond %{HTTP_HOST} ^example\.net
RewriteRule (.*) http://www.example.net/$1 [R=301]
RewriteCond %{HTTP_HOST} ^parked\.net
RewriteRule (.*) [parked.net...] [R=301,L]
Now both domains work fine and show the same sites:
Next step: avoiding dupe content.
Parked.net only redirects on example.com/sub/
Could you suggest me how to edit the rules?
Adding a further one?
Thanks
RewriteCond %{HTTP_HOST} ^(www\.)?example\.net
RewriteRule ^sub(.*) [parked.net...] [R=301]
RewriteCond %{HTTP_HOST} ^example\.net
RewriteRule (.*) http://www.example.net/$1 [R=301]
RewriteCond %{HTTP_HOST} ^parked\.net
RewriteRule (.*) [parked.net...] [R=301,L]
Now I get example.net/sub/ redirecting to parked.net/sub/ as I want (but url contains a slash more: parked.net/sub// instead of parked.net/sub/).
example.net rests example.net.
But parked.net still matches example.net...
RewriteRule ^sub/(.*) http://www.parked.net/sub/$1 [R=301,L]
.
However, don't you want the second site to be served as if it were in the root of parked.net?
RewriteRule ^sub/(.*) http://www.parked.net/$1 [R=301,L]
.
You also need the [L] flag on the rule as it is the Last rule that needs to be processed.
#canonicalize parked domain
RewriteCond %{HTTP_HOST} ^parked\.netRewriteRule (.*) [parked.net...] [R=301]
#redirects parked domain search.pl file requests to the main one preventing duplicate issue
RewriteCond %{HTTP_HOST} ^www\.parked\.netRewriteRule ^search.pl(.*) [main.net...] [R=301]
#canonicalize main domain
RewriteCond %{HTTP_HOST} ^main\.netRewriteRule (.*) [main.net...] [R=301]
#redirects main domain sub requests to the parked one
RewriteCond %{HTTP_HOST} ^www\.main\.netRewriteRule ^sub/(.*) [parked.net...] [R=301,L]
The rules work fine formy pourpose only in that exact order.
Do you see something wrong?
Could they be rewritten in a simplest way?
Are they bug proof (am I missing something that opens to duplicate issues)?
Thanks for your kind feedbacks :-)
I warned about that in a post above.
Again, the rules also need [L] to be added.
Do the specific requests first, with domain canonicalisation included in the rule.
Then do the general domain canonicalisation for all other URLs afterwards.
Did you see that main.net/sub will be redirected to www.main.net/sub and then redirected again to www.parked.net?
I warned about that in a post above.
It's what I want:canonicalizes and redirects but to parked.net/sub/.
It's that what I see.Am I wrong?
Again, the rules also need [L] to be added.
For each one?
Do the specific requests first, with domain canonicalisation included in the rule.Then do the general domain canonicalisation for all other URLs afterwards.
I'm not able to do that...
Could you help me please?
Thanks
You also want a "specific thing" to redirect to one specific place.
.
Do the "specific" thing first, making sure that it works for any starting domain, and that domain canonicalisation is also included in that rule for the "specific" thing.
Lastly do the "general" thing; that is for "all other" URLs (i.e. all the non-www).
.
It is just a case of putting all of the rules in the correct order.
Check the example out in [webmasterworld.com...] to see what mean about that.
That example caters for one specific file path first (whether www or non-www), then for all index files (whether www or non-www), and then finally for all the others (everything non-www).