hello, i have a website that gets all its link from http://largemouthbasstips.com but yahoo only has http://[B]www.[/B]largemouthbasstips.com does this matter? if so how would i 301 the www domain to the http domain? thanks!
Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^yourdomain\.com RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=permanent,L] That'll do it for you. Or reverse it if you want the 301 to go the other route.
Both forms of the URL reach your page. As long as this is true it does not matter and you do not need to do any redirects. Putting the "www." before the domain is the conventional way of expressing a URL. In recent years, more people have opted not to do so. However, disallowing its use is not a good idea, because many people put "www." before the domain name in a URL when typing it out by hand. If it does not work, they will not get the problem.
Clancey, sorry but your wrong. Until Google sort out their canonical issues, it will treat www.domain domain. www.domain.com/index.php domain.com/index.php All as different pages and domains. As such, it will split your lihnk benefit across all those pages. This is why you should link to one set format ie www.domain.com or domain.com. Never hard code it to domain.com/index.htm as .htm .html .php .asp .cfm etc are all different pages in the eyes of the search engines. The ideal way to handle it is with local bind DNS at server level, but this is not always possible with certain hosting companies, and so a 301 is the only safeguard
the code gave a 500 error. can i get a code that: redirects www.largemouthbasstips.com TO largemouthbasstips.com thank you for your help!
ok i got it to somewhat work RewriteEngine On RewriteCond %{HTTP_HOST} ^largemouthbasstips.com RewriteRule (.*) http://www.largemouthbasstips.com/$1 [R=301,L] but now it redirects to http://www.largemouthbasstips.com/index.php is there a way to simply redirect it to http://www.largemouthbasstips.com/ and NOT the index.php
The index.php is the default page that is being directed. If you put a .htm, or .html page there it would default to that as well The displaying of the /index.php page is handled by the server software, and will not affect the forwarding. The way you have done it is quite right.
I use the following to redirect from www.domain.com/index.php3 to www.domain.com and http://domain.com to www.domain.com RewriteCond %{HTTP_HOST} ^pyramidlinking.com RewriteRule (.*) http://www.pyramidlinking.com/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php3\ HTTP/ RewriteRule ^index\.php3$ http://www.pyramidlinking.com/ [R=301,L] Code (markup): Old Welsh Guy why do you not suggest this? I thought it was always needed?
i realise what the index page does. its just im not sure if the search engines would see both www.largemouthbasstips.com AND www.largemouthbasstips.com/index.php and split the PR between the 2 pages and possibly penalize me for duplicate content
hmmm, I cut & pasted right out of my working code. Have you put it in exactly the same order that I posted? Are there any other things in the htaccess file?
if i put it in EXACTLY as you say substituting your domain for mine and substituting php3 to php it does not work at all.. no redirections take place if i add RewriteEngine On so it looks like this then i get the following error
Sorry, if that doesn't work I can't help more. The following is my entire htaccess file for the pyramidlinking.com site which works fine ErrorDocument 404 http://www.pyramidlinking.com/404.php3 RewriteEngine on RewriteCond %{HTTP_HOST} ^pyramidlinking.com RewriteRule (.*) http://www.pyramidlinking.com/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php3\ HTTP/ RewriteRule ^index\.php3$ http://www.pyramidlinking.com/ [R=301,L] Code (markup):
well i managed to get around it by using notice there is not /$1 now the only problem this causes is if you enter for example http://largemouthbasstips.com/articles.htm you get redirected to www.largemouthbasstips.com i will leave these rules and keep an eye on my raw data to se eif it causes any conflicts. thank you for all your help! and if you want to add something PLEASE DO
Zibzer- I still see a separate page at http://www.largemouthbasstips.com/index.php. I too am trying to figure out how to redirect http://www.example.com/index.php. to http://www.example.com/. Mad4's code didn't work for me either. Everything else seems to redirect the way I want it with:
Try: Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^largemouthbasstips.com\.com$ RewriteRule (.*) http://largemouthbasstips.com/$1 [R=301,L]