Possess a strange trouble with Apache .htaccess URL Spinning and Redirection. Here's my setup: I've got a zend application having a single reason for entry (index.php) directly under my apache document root (refer to this as the "public" folder). I additionally have other public documents (images, js, css, etc.) underneath the public folder. Here, I in addition have a wordpress blog underneath the "blog" folder. There's a clear test folder too

The Issue

After I visit example.com/blog, I recieve rerouted to http://www.example.com/blog (properly), then to http://www.example.com/blog/ (simply with an additional / at finish), finally to http://example.com/blog/ -- and we are back where we began. The loop continues. Things I do not understand is the reason why would wordpress attempt to take away the www? I am speculating it's wordpress because my empty test folder functions all right!

Another strange this really is will be able to really visit www.example.com/blog/wordpress-login.php or example.com/blog/wordpress-login.php also it really LOADS UP!!!!!

Help. I"M REALLY DESPERATE :( Thanks greatly

Other activities which happen:

After I visit example.com, i properly get rerouted to www.example.com

After I visit www.example.com, i properly stay where I'm

After I visit www.example.com/test or example.com/test, behavior is correct.

Setup

So my .htaccess file does the next:

  • If there is no www., adding it and perform a 301 redirect. Here's the code I personally use

RewriteCond %{HTTP_HOST} ^example.com [NC]

RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

  • When the request isn't for any resource (image, etc.), or even the blog, then load zend application by spinning to index.php

RewriteRule !((^blog(/)?.*$)|(.(js|ico|gif|jpg|jpeg|png|css|cur|JPG|html|txt))$) index.php

Many thanks for your help!!! Ali

Have you look into the configurations in Wordpress? Sign in to admin and appearance Settings/Basics (or what it's contacted British, I am utilizing a Swedish translation). There you are able to configure which URL Wordpress is applying. Whether it's set without www., Wordpress will attempt to redirect.