Website too many redirects

Can anyone show me how to modify my .htaccess file so I can redirect my non-www to www. Please take a look below. My site caught an error “Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.”

My .htaccess file

BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} !^www.mydomain.com$
RewriteRule ^(.*)$ http://www.mydomain.com [R=301,L]
</IfModule>

END WordPress

My Permalink settings

/%category%/%postname%/

Read this before posting or your thread will be deleted! And [URL=“http://www.000webhost.com/forum/customer-assistance/4-forum-rules.html”]Forum Rules, You need to read them. Do not post the same question in multiple threads. [URL=“http://www.000webhost.com/forum/web-programming/31472-redirect-non-www-www-new-post.html”]Redirect non-www to www < this is the same question. Just wait and someone that can help will.

I posted into wrong category. I need customer service assistance. I will delete the old post . I apologize

No need to apologize, I’m just trying to help you get an answer. Posting in several areas will only get all the post deleted and no help there.
What is your site URL? I might be able to help, If not it’ll be a starting point for someone with more expertise.

Thanks for your help.

Have you checked if the WPML plugin is enabled? It needs to be disabled.

Hie Ken,

How do you disable WPML plugin ? Please guide me.

Thank you

Try this in your .htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST}  ^example.com [nocase]
RewriteRule ^(.*)         http://www.example.com/$1 [last,redirect=301]

Its not working Ken. Do you have other options?

Do not remove this line, otherwise mod_rewrite rules will stop working

RewriteBase /

BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain.com [nocase]
RewriteRule ^(.*) http://www.mydomain.com/$1 [last,redirect=301]
</IfModule>

END WordPress

What are you using to edit your .htaccess file? Note pad, word pad or some other editor?

I’m using a notepad to edit it. Does it effect?

Yes notepad and word pad both insert invisible characters that can cause problems with any code editing. Use Crimson Editor www.crimsoneditor.com It’s free and works great.
Also I found this page It may help you more than I can, I’m not real good with the .htaccess editing :frowning:

One more question Ken . Do i need to change WordPress Address (URL) and Site Address (URL) in wordpress General Settings to www.mysite.com for it to work?

You mean change it to “http://www.androidbegin.com/”? I think so.

Thread moved.

I see you got your site redirect working, what did the trick? Post it so we know in case someone else has the same problem. :slight_smile:

I just change WordPress Address (URL) and Site Address (URL) in wordpress General Settings to http://www.mywebsite.com for it to work. No need to modify the .htaccess file.

Thanks Ken.

Problem solved.

1 Like

Sad something so simple was the solution lol