Here is what i have so far in .htaccess, this created by Wordpress: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress I have tried the following, no success: redirect 301 mysite.com/old-file-name.htm http://www.mysite.com/old-file-name.htm Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^mysite.com [NC] RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301] Result is that it is going to my www.mysite.com not www.mysite.com/old-file.htm I have also tried this: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} !^www RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [L,R=301] # END WordPress But none seem to work. It give not found error. can someone help me out. In Wordpress settings I have the following: Options -> General->Wordpress address: http://www.mysite.com Options -> General->blog address: http://www.mysite.com Permalink structure Custom Thanks,
I am using the following before the rewrites: Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC] RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
There's an even easier way to do it, check out the www enforcer plugin by my friend Mark. http://txfx.net/code/ it's a plugin that redirects for you, no htaccess editing involved...
I just upload the into the plugin and activated. Question about this: "From now on, you can edit slugs without worry! If you have an old post whose slug you changed (prior to installing the plugin), you can manually add an old_slug Custom Field for that entry, and it will be forwarded." You mean I have to modify every old blog posting I have. My problem is this: google see my web as two: mysite.com and www.mysite.com msn has indexed my site as mysite.com/archieve/blah When I do the redirect so the traffic coming from msn will be directed from mysite.com/archieve/blah to www.mysite.com/archieve/blah. For some reason, links to the blog posting are displayed as not found
It takes about 5 seconds to add the code I gave you to your htaccess file to prevent this issue, but it must be added before the mod_rewrites listed.
You're looking at the wrong plugin then, just look at this one: http://txfx.net/code/wordpress/enforce-www-preference/ -- that will give you everything you need. His /code/ page has a lot of other good plugins too, but the www-enforcer is what you need to resolve this.
Now the msn traffic are redirected as I like. Plugin is pretty good. So one final question: This plugin now force www.mysite.com. So that means, no mix up with google identifying my site as two: mysite.com and www.mysite.com Thank you.....
Yep that's correct. Now whenver someone types in domain.com it will redirect to www.domain.com, same with robots. I use it for all my blogs so that there are never any pagerank discrepencies or anything..
Also, does this script take care of www.mysite.com/index.php to www.mysite.com ? If not, how can I do this?
Hi, There are no links to /index.php in my WordPress blog, except the links to the search results which are /index.php?s=blahblah. If you do not link to /index.php yourself, as other sites will most probably link to /, there will be no problem. Jean-Luc
Hi folk, I want non www to www redirection for my one important WordPress blog. I have enabled the Permalink to make URL SEOF(Search Engine Optimization Friendly). I placed the below code in my .htaccess file which is located on web server root. But what all I get is "Redirect Loop" error in Firefox. # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^mydomain.com[nc] RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress Am i missing anything ? A little help is appreciated. Thanks in advance Regards, Sachin Pethani(Web-Farmer) www.letsnurture.com
@Yardy009 I have tested your .htaccess. It works on my blog. You just need to login to your wordpress blog, and change: Settings - General WordPress address (URL) : www.mydomain.com Blog address (URL) : www.mydomain.com That's all.