Website too many redirects


#1

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%/


#2

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.


#3

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


#4

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.


#5

Thanks for your help.


#6

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


#7

Hie Ken,

How do you disable WPML plugin ? Please guide me.

Thank you


#8

Try this in your .htaccess

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

#9

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


#10

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


#11

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


#12

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:


#13

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?


#14

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


#15

Thread moved.


#16

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:


How to point domain name to 000webhost.com
#17

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.


#18

Sad something so simple was the solution lol


#20