10-08-2009, 02:20 PM
admin's Avatar
admin admin is offline
Site Staff | Web Development
Join Date: Jul 2003
Posts: 4,307
Thanked 655 Times in 457 Posts
Today I finally got around to solving a problem that has bugged me with a site in development. Embarrassingly, it's an easy fix, and should have been an easy find. But in my defense, a LOT of other people are having this issue!

So I'm sharing my fix...

When I added a "enforce www" code to my htaccess file -- which helps prevent dupe content, good SEO practice -- I found myself locked out of WordPress. It was in a loop when I went to wp-admin and logged in, it would just return to the wp-login.php page. The username and password was accepted, it just failed to go anywhere.

I had to leave the non-www version up, and face the consequences of duplicate content from search engines. Ugh!

The fix was simple. When I had set up WordPress, I had specified "site.com" as the WordPress address (URL) and Blog address (URL). Under the GENERAL SETTINGS (settings > general) area in the WordPress back-end, I simply changed this to "www.site.com". Obviously, I had to remove the htaccess code to allow for this.

Had I been unable to log into WordPress, neither through www or non-www, I'd have needed to login to the mySQL database directly, search for the entry, and then change it with an SQL query. Luckily, it did not come to that. (Tip: SQLyog is EXCELLENT software for managing mySQL databases!!)
NOTE: If you find yourself in this bind, sign up as a forum member, and post that you need some help with an SQL query, to fix this issue!

The htaccess code now works perfectly...

PHP Code:
RewriteCond %{HTTP_HOST} ^site.com [NC]
RewriteRule ^(.*)$ http://www.site.com/$1 [L,R=301] 
... and I can login to WordPress. No more dupe content!

Hope this helps you out.

- Did this site help you? Then upgrade to Premium Member and show your support!
- Also: Like Us on Facebook for special DVD/Blu-ray news and deals!
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts

Similar Threads
Thread Thread Starter Forum Replies Last Post
WordPress themes library (by style), free and premium designs admin Web Development, Design 4 03-04-2013 02:19 PM
List of Useful WordPress 3.x plug-ins [research] admin Website and Server Troubleshooting 1 08-11-2009 12:50 AM
Login Problems for Old Members (pre-2008 members) admin General Discussion 0 12-22-2008 11:06 AM
Laserdisc skipping frames (SOLVED) Tranzor Capture, Record, Transfer 7 07-13-2007 12:31 PM
Having login trouble? (IE5,IE6) Here’s the fix... admin General Discussion 0 04-19-2004 03:32 PM

Thread Tools

All times are GMT -5. The time now is 12:53 PM