Canonical URL - WITH Wordpress blog in Subdirectory

3 replies
  • WEB DESIGN
  • |
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:// www.myurl.com/$1 [R=301,L]


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

Now the problem is, I tried to access my blog by typing http://myurl.com/specialoffers/ , which was without the www. It keeps on redirecting and never able to successfully load my blog up. However, if I type
http://www.myurl.com/specialoffers/
, 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.
#blog #canonical #subdirectory #url #wordpress
  • The problem is you cannot use the above code for sites in subdirectories and install your htaccess file in the root. It will make your blog redirect. You have to write specific code for each site in the subdirectory.
    Signature
    Financial Thing: Peer to Peer Lending Reviews
    Poker Tilt : The Dutch Boyd Story
    {{ DiscussionBoard.errors[1852423].message }}
  • Profile picture of the author AidenChong
    Thanks, my friend.

    Do you have any other suggestion where I can improve the canonical url for the whole site? Where can I get such codes? I am such a dummy when it comes to codes ...
    {{ DiscussionBoard.errors[1855248].message }}
    • Profile picture of the author phiwebsolutions
      It's a common issue,the htaccess you are using is not proper.As you are hardcoding the URL in the htaccess hence you are getting the error
      Instead of making the redirection based on harcoded URL make it to work with in respect to index.php and use a redirection base.
      Hope that helps.
      In case you need further help PM me exactly what you want to achieve and I'd try to give you the exact htaccess for that.
      {{ DiscussionBoard.errors[1856022].message }}

Trending Topics