Forum Moderators: phranque
Below is an example of what I currently have in my .htaccess.
Can anyone offer code examples of how I can get NEW-DOMAIN.com to point to EXISTING-DOMAIN/SPECIFIC-PAGE.html?
Thank you very much.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^EXISTING-DOMAIN\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^NEW-DOMAIN\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.) NEW-DOMAIN\.com [NC,OR]
RewriteRule (.*) [EXISTING-DOMAIN.com...] [R=301,L]
Options +FollowSymLinks
RewriteEngine on# Redirect to add "www" prefix for existing or new domain
RewriteCond %{HTTP_HOST} ^existing-domain\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^new-domain\.com [NC]
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
# Internally rewrite new domain home page requests to a specific page
RewriteCond %{HTTP_HOST} ^www\.newdomain\.com
RewriteRule ^$ /specific-page.html [L]
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim
Question:
Based on what you said it seems that "specific-page" will be accessible via two differnt urls:
1) new-domain.com
2) existing-page-name.html
Bacause of the bad news re: Google and duplicate content, is there anyway to force new-domain.com to only show existing-page-name.html and not cuase any problems that Google or other SEs will trip on?
I will do what you say.
But is there any way could you post the additional code lines? The reason it's important to me is because as soon as the first layer is running smoothly and tested I would want to add the additional layer immediately to avoid ANY Google duplicate content penalties.
I just got out of Google hell after more than 11 months.
However, if we code both parts, and I am wrong about one little detail in both parts, then you will have twice the problem you would have if only the first part was wrong...
Also, I must choose how to spend my time here, so I must ask you to test the first part before going any further... Thanks.
Jim
Thank you for your code examples. I could not get them to work how I wanted. :(
I have one main-domain and 12 pointer-domains. I want all domains to resolve to: www.main-domain.com. The code below DOES accomplish this.
I also do not want to display index.html or index.htm. The code below DOES accomplish this.
MY CHALLENGE:
Have www.pointer-domain1.com AND pointer-domain1.com both point to an inner page of my site and show the inner-page url in the browser bar. For example, this page:
www.main-domain.com/store/specific-inner-page.html
Can you suggest code that will work in harmony with what I currently have?
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^main-domain\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^ pointer-domain1\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)? pointer-domain1\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^ pointer-domain2\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)? pointer-domain2\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^ pointer-domain3\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)? pointer-domain3\.com [NC]
RewriteRule (.*) [main-domain.com...] [R=301,L]
RewriteRule ^(([^/]+/)*)index\.html$ [main-domain.com...] [R=301,L]
RewriteRule ^(([^/]+/)*)index\.htm$ [main-domain.com...] [R=301,L]
Thank you.
You've introduced some unnecessary redundancy; Don't duplicate RewriteConds and RewriteRules for www- or non-www and "html" or "htm" -- Use the power of regular expressions to handle optional characters and groups of characters:
Options +FollowSymLinks
RewriteEngine On
#
# Redirect "/index.html" or "/index.htm" to "/" {in any (sub)directory}
# (Use THE_REQUEST to prevent a loop caused by interaction with DirectoryIndex)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?[^\ ]*\ HTTP/
RewriteRule ^(([^/]+/)*)index\.html?$ http://%{HTTP_HOST}/$1 [R=301,L]
#
# Redirect pointer-domain1/ or www.pointer-domain1/ to specific page
RewriteCond %{HTTP_HOST} ^(www\.)?pointer-domain1\.com [NC]
RewriteRule ^$ http://www.main-domain.com/store/specific-inner-page.html [R=301,L]
#
# Redirect all other non-canonical (www- or non-www) domains to the canonical domain
RewriteCond %{HTTP_HOST} ^main-domain\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)?pointer-domain2\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.)?pointer-domain3\.com [NC]
RewriteRule (.*) http://www.main-domain.com/$1 [R=301,L]
[edited by: jdMorgan at 4:37 am (utc) on July 4, 2007]