• I moved my blog from the root to a the directory /blog and created the .htaccess code below to redirect the broken inbound permalinks. Now I am moving it to a subdomain blog.theenchantedimage.com and I have two problems:
    1) The code at the bottom works for my directory of my root /blog
    with the broken links but it won’t work on the subdomain
    blog.theenchantedimage.com
    2) The code below is also redirecting anyone that goes to my root
    to the blog and I want to make sure in the future that won’t
    happen as I will be hosting a website on the root.

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^theenchantedimage\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.theenchantedimage\.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/\blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /\blog/$1
    RewriteCond %{HTTP_HOST} ^(www.)theenchantedimage.com$ [NC]
    RewriteRule ^(/)?$ blog/index.php [L]

    I was thinking that I needed to use the <IfModule mod_rewrite.c> to avoid searches going to the website I will be hosting on the root directory but I haven’t been able to figure this out. Any help would be greatly appreciated as I am have been pulling my hair out trying to figure this one out and it just doesn’t matter how many articles I read I can’t get it to work.

    Thanks In Advanced!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Consider using a plugin to handle your .htaccess file for you. If you are not sure what you are doing, it is always better to have it done for you.

    I will recommend using the following plugin for your situation:
    http://wordpress.org/extend/plugins/redirection/

    Very straight forward. You will figure it out without a doubt.

    P.S. If you screwed up your .htaccess file, just delete it, then update your permalink settings in the dashboard. It will automatically generate a new .htaccess file for you. I would actually recommend doing this before you install the plugin, just to be sure everything is correct.

    Thread Starter pcdaugs

    (@pcdaugs)

    Hello w3dgie,

    I have looked at the plugin you are recommending and it doesn’t work. This plugin works with the .htaccess file in the directory WordPress is saved in but does not work on the .htaccess file you have in any other directory. Since my blog was originally hosted on my root I have to have the .htaccess file in the root directory to handle any of the broken links. If it was any other way I would completely agree with you to let WordPress handle it and call it done but that just isn’t the case here. Any help with correctly coding the rewrite rule in the .htaccess file would be most welcome.

    Thanks Again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Moved Blog Now Rewriting Broken Inbound Permalinks in .htaccess File’ is closed to new replies.