Want to run wordpress in a subdirectory and keep my main site separate in the root

I have an eCommerce website in the root directory and want to move my blog to a subdirectory. I successfully made the move from another domain to this one but when I attempt to go to the blog home page it re-directs to my eCommerce site’s home page.

The eCommerce site – http://www.heavytshirt.com
The blog location – http://www.heavytshirt.com/blog

Read More

The .htaccess file in the blog directory looks like this:

RewriteEngine on
RewriteBase /

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

# END WordPress

And the .htaccess file in the root directory looks like this:

DirectoryIndex /mm5/merchant.mvc?Screen=SFNT

RewriteEngine On

RewriteRule ^mm5/admin.mvc? - [L]

RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^product/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Product_code=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^category/([^/.]+).html$ /mm5/merchant.mvc?Screen=CTGY&Category_code=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^product/([^/]+)/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Category_code=$1&Product_code=$2 [L]

RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^([^/.]+).html$ /mm5/merchant.mvc?Screen=$1 [L]

### End - Inserted by Miva Merchant

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^heavytshirt.com [nc]
RewriteRule ^(.*)$ http://www.heavytshirt.com/$1 [r=301,nc]


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

# END WordPress

Currently I am able to type in a subsequent sub directory and get to a post – Like:
http://www.heavytshirt.com/blog/category/summershirts/

What can I do to make the blog home page come up when someone types in http://www.heavytshirt.com/blog
And not affect the main site at www.heavytshirt.com

Related posts

Leave a Reply

2 comments

  1. Your issue is because you have set

    DirectoryIndex /mm5/merchant.mvc?Screen=SFNT
    

    Because /blog/ is a directory and the rules you have set are matching that as the directory index for /blog/ (because the directory actually exists).

    You will have to combine the two Rewrite Directives to get the desired result (you don’t need RewriteEngine On in there twice).

    Probably better that you start from scratch testing line by line to make sure you get the desired result.

    I can’t test this, but you get the idea:

    Options +FollowSymlinks
    
    RewriteEngine On
    
    RewriteBase /
    RewriteRule ^mm5/admin.mvc? - [L]
    RewriteCond %{REQUEST_FILENAME} !-s
    RewriteRule ^product/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Product_code=$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-s
    RewriteRule ^category/([^/.]+).html$ /mm5/merchant.mvc?Screen=CTGY&Category_code=$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-s
    RewriteRule ^product/([^/]+)/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Category_code=$1&Product_code=$2 [L]
    RewriteCond %{REQUEST_FILENAME} !-s
    RewriteRule ^([^/.]+).html$ /mm5/merchant.mvc?Screen=$1 [L]
    RewriteCond %{http_host} ^heavytshirt.com [nc]
    RewriteRule ^(.*)$ http://www.heavytshirt.com/$1 [r=301,nc]
    
    RewriteBase /blog/
    RewriteRule ^index.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]