Canonical URL - WITH Wordpress blog in Subdirectory

[FONT=verdana][SIZE=2][COLOR=#000000]Hi there,

I have a question about canonical URL.

I have been using the following code for around 2 years without any problem. Until recently, after installing a Wordpress blog in a subfolder, I have encountered 1 problem. The code was :

RewriteEngine On
RewriteCond %{HTTP_HOST} ^myurl\.com [NC]
RewriteRule ^(.*)$ http://$1 [R=301,L]

**Note that I put a space in front of www because the forum will automatically wrap it into a clickable URL if I don’t do so.

I tried to install my wordpress blog in this directory named specialoffers , so the full directory would be http:// , if I wanted to visit my blog.

Now the problem is, I tried to access my blog by typing http:// , which was without the www. It keeps on redirecting and never able to successfully load my blog up. However, if I type http:// , it can then be loaded up without any problem.

So I tried to delete the rewrite engine code from my .htaccess, it works for the non-www and the www version. My blog shows up.

So can anyone please help me with this problem? I would like my entire site (including the Wordpress blog directory to be loaded up with WWW). Is there any other codes that I can use in this case?

I’ve tried this in Google Chrome, Firefox, and also Internet Explorer, all of them were unable to load up the page as mentioned.

I have posted the image of the problem for each of the 3 website explorers and Google Chrome has a notice saying TOO MANY REDIRECTS.

Thanks in advance for any help given. [/COLOR][/SIZE][/FONT]


You CAN put code in a code block in this forum without modifying the link.

The code you supplied looks okay (if you are using Apache 2.x) but you could try some of the other codes I supply in my signature’s tutorial article.

Finally, because you didn’t post ALL your mod_rewrite code, I suspect that there is a problem between the force-www code and WP’s code. Just be sure that the force www is before the WP code and you should be fine. Note, too, though, that you cannot change WP’s physical location without changing its config file (and, probably, the mod_rewrite code that it inserts in your DocumentRoot’s .htaccess).



Thanks for the reply, David :slight_smile:

Your site looks very informational! Unfortunately, I am a dummy in coding stuffs :frowning:

Thanks for your comments anyway. I have found a solution for this one and it’s really a pain in the *** for a coding dummy like me …