Forum Moderators: phranque

Message Too Old, No Replies

Need Help Please

         

janasko

1:54 am on Oct 22, 2011 (gmt 0)

10+ Year Member



I have 2 dmain names hosted on networksolutions.

protectmychildcare.com
protectmydaycare.com

I'm trying to get the www and non www of each domain to point to [protectmychildcare.com...]

Everything seems to work fine using my method. However, I recieve an error when trying to submit a sitemap to Google.

Can ayone help?

Here is the code that was used:


RewriteEngine On
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^www.protectmydaycare.com [NC]
RewriteRule (.*) http://protectmychildcare.com/wordpress/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^protectmydaycare.com [NC]
RewriteRule (.*) http://protectmychildcare.com/wordpress/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^www.protectmychildcare.com [NC]
RewriteRule (.*) http://protectmychildcare.com/wordpress/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^protectmychildcare.com [NC]
RewriteRule (.*) http://protectmychildcare.com/wordpress/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^www.protectmychildcare.net [NC]
RewriteRule (.*) http://protectmychildcare.com/wordpress/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^protectmychildcare.net [NC]
RewriteRule (.*) http://protectmychildcare.com/wordpress/$1 [R=301,L]




ANY HELP WOULD BE APPRECIATED!

lucy24

2:35 am on Oct 22, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You may have run into the gwt paradox. In order to tell them that you don't want to use a particular name (for example with or without www) you have to start an account with that same unwanted name.

The sitemap goes under the domain name that you do want to use.

g1smd

6:51 am on Oct 22, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Rule number 4 introduces an infinite redirect loop.

Are there folders other than /wordpress on this site?

If not, I think you should use a RewriteRule to redirect the other domains to the root of the wanted domain and another RewriteRule to rewrite root requests to the wordpress script in the wordpress folder. In that way, /wordpress/ doesn't need to appear in the URLs. You would also need to alter the Wordpress configuration to not show /wordpress in the href links on the pages of the site.

If there are folders other than /wordpress/ on the site, then the rules for the other domains should use ^wordpress/(.*) as their Regex pattern instead of just (.*) and the RewriteRule for the wanted domain should have a preceding RewriteCond that checks that REQUEST_URI is NOT ^/wordpress using ! for "not".

Your rules could also be simplified. Use the pattern ^(www\.)? to combine two rules into one for the first two and the last two rules.

janasko

7:37 am on Oct 22, 2011 (gmt 0)

10+ Year Member



Thanks for the reply g1smd.

I would like yo use other folders if possible. Could you provide some examples or point me to a website with some creditable examples?

janasko

7:38 am on Oct 22, 2011 (gmt 0)

10+ Year Member



Thanks lucy24. I will consider your advice.

lucy24

7:56 am on Oct 22, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your rules could also be simplified. Use the pattern ^(www\.)? to combine two rules into one for the first two and the last two rules.

(day|child)
\.(com|net)

;)

g1smd

8:49 am on Oct 22, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Be careful because if you use those two simplifications and the (www\.)? sugggestion together then it will create an infinite redirect loop.

lucy24

9:01 am on Oct 22, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes, I realized that about five minutes after I posted. You want all possible permutations of abcdef except, uhm, badcfe. So to speak.

janasko

6:49 pm on Oct 22, 2011 (gmt 0)

10+ Year Member



To anyone that needs to have 2 domain names pointing to the same folder, here is the solution:

RewriteEngine On
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^(www.)?domain1.com$
RewriteRule ^(/)?$ /wordpress [L]

RewriteCond %{HTTP_HOST} ^(www.)?domain2.com$
RewriteRule ^(/)?$ /wordpress [L]

Hope this helps.

lucy24

9:40 pm on Oct 22, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You're going to need either a RewriteBase or a full path for your Rule. And a [R=301] flag so it isn't read as the default 302.

You don't need parentheses around a single literal character unless you're capturing it.

That's assuming neither domain1 nor domain2 is the domain you plan to end up in. Otherwise we're back in infinite-redirect territory.

I originally read the above post as literal strings and thought "why can't he simply say 'domain[12]'?" Oops.

g1smd

10:20 pm on Oct 22, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The above code is problematical in multiple ways.

The solution should be a set of external redirects to the canonical hostname, preserving the requested path in the redirect.

The code you presented preforms an internal rewrite for www and non-www requests for both domains. This promotes duplicate content.

Additionally, the ^(/)?$ notation makes requests for both example.com/ with a single slash and example.com// with a double slash valid - yet more duplicate content (and all of those with non-www and www versions for all hostname variants).

There's another problem here too. As soon as you request example.com/somepage, instead of the root, the code no longer operates.