Forum Moderators: phranque
I just made by decision, after looking carefully at the different opinions I have been given in the [webmasterworld.com...] thread.
What I will do is redirect from
www.example.com to www.example.com/fun.html
My question about this is that I already have a .htacess fille, containing the following:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*) http://www.example.com/$1 [R=301,L]
So if I want to apply correctly the new redirect (from "/" to "fun.html" written above), is this as simple as adding the suggested code?
(RewriteRule ^(index\.html)?$ http://www.example.com/fun.html [R=301,L])
Thanks for the advice.
One thing though. I had to add "R=301," at the line "RewriteRule .? /fun.html [L]" so that it becomes
RewriteRule .? /fun.html [R=301,L]
I guess it is the best to have permanent redirect (301) so that the Pagerank of the example.com page gets to the wxample.com/fun.html page.
Does it seems right to you?
Thanks again!
From the thread you referenced:
Think about the long term health and desirability of your domain. Redirecting to an internal page looks amateurish and isn't what anybody would ever want.
And long term it could be playing with fire; you can't always depend on search engines getting it 100% right, not immediately or in future. Not only is it totally unconventional, but a lot of directories won't index pages other than the root homepage. And index.html or index.htm should also be 301 directed to the root example.com/ (with the forward slash).
[edited by: Marcia at 2:58 am (utc) on Feb. 18, 2008]
As jdMorgan pointed out in response to my question in another thread, this should work too:
Options +FollowSymLinks
RewriteEngine on
#
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
#
RewriteRule ^$ /fun.html [L]
#
Regarding Marcia's comment, surely http://www.example.com/ is what will appear in the browser address bar, not http://www.example.com/fun.html - because this is a "hidden" Rewrite, not a redirect. And there's no need for R=301.
I don't see the purpose of this exercise, though.
[edited by: Patrick_Taylor at 8:36 am (utc) on Feb. 18, 2008]
I don't see the purpose of this exercise, though.
Regarding Marcia's comment, surely http://www.example.com/ is what will appear in the browser address bar, not http://www.example.com/fun.html - because this is a "hidden" Rewrite, not a redirect. And there's no need for R=301.
So there is the original www.example.com/fun.html with lots of inbound links (and this URL will appear in the browser when that page is requested) and there is now also www.example.com/ which displays the same content. That's no use at all.
Without going into too much depth, the option is not to Rewrite www.example.com but to 301 redirect www.example.com/fun.html to www.example.com/. But the consensus in the other thread seems to be "leave well alone."
[edited by: Patrick_Taylor at 10:58 am (utc) on Feb. 18, 2008]
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*) http://www.example.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule .? /fun.html [R=301,L]
Does it seems Okay to you?
Marcia, I did not want to pick and choose want I wanted to hear in the [webmasterworld.com...] thread. It looks like there was no best way to do it, and since there are hundred of inbound links pointing to www.example.com/fun.html, I'd rather not risk redirecting them with a 301 to the main page.
But these are not easy decisions... :-(
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteRule ^$ /fun.html [L]
(See #:3577667 above)
But now, you have www.example.com/fun.html and www.example.com/ with the same content, because this Rewrites the homepage to the "fun" page. The second RewriteRule is not a redirect.
Patrick
[edited by: Patrick_Taylor at 1:07 pm (utc) on Feb. 18, 2008]
Marcia, the reason I want to do this is because I'm redesigning the site right now, and I plan to ship some t-shirts to bloggers to advertise the new "version". And I'd rather have "example.com" on the t-shirt instead of "example.com/fun.html".
Patrick, you wrote: "The second RewriteRule is not a redirect." Is it my second RewriteRule thats is not a redirect (RewriteRule .? /fun.html [R=301,L] ) ? What I want are 301 redirects, to control the flow of PageRank.
Marcia, following your comment ##:3577530 , I also added the following line:
Redirect 301 /index.html http://www.example.com/fun.html
It was needed since www.example.com/index.html was not 301 to the http://www.example.com/fun.html page. Thanks.
So, here is my .htaccess right now:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*) http://www.example.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule .? /fun.html [R=301,L]
Redirect 301 /index.html http://www.example.com/fun.html
Knowing that I want to send the PageRank from example.com to example.com/fun.html, does it seems OK to you?
Thanks again for your help.
Shrike99
RewriteEngine on
RewriteBase /
#
# Redirect requests for "/index.html" and "/" to www.example.com/fun.html
RewriteRule ^(index\.html)?$ http://www.example.com/fun.html [R=301,L]
#
# Redirect all remaining requests for any resources in example.com to www.example.com
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]