.htaccess overwrites parent .htaccess

So I’ve been struggling with this for a whole day and nothing helped so far.
I’ve got a PyroCMS installed in the root of the domain and a sub-domain blog in the same folder (public_html).

Now the problem is that when visiting http://dev.iber.co.uk/blog/ I’m seeing blog.iber.co.uk instead. Obviously that’s because the blog folder exists and it’s not just a url rewritten by htaccess.

Read More

The folder structure:

public_html
   blog
      .htaccess
      .index.php
      etc..
   .htaccess
   index.php
   etc..

However if I remove the htaccess from blog folder dev.iber.co.uk/blog/ gets rewritten to index.php as it should.

Here’s the .htaccess for the dev.iber.co.uk(this sub-domain is actually pointing at root public_html folder):

Options +FollowSymLinks -Indexes
RewriteEngine on
RewriteBase /

RedirectMatch 403 ^/(system/cms/cache|system/codeigniter|.git|.hg).*$

RewriteCond %{HTTP_HOST} !^blog.iber.co.uk [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]

Here’s the .htaccess from the wordpress blog:

Options +FollowSymLinks -Indexes
RewriteEngine on
RewriteCond %{HTTP_HOST} ^blog.iber.co.uk [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]

What am I doing wrong? I have no access to rewrite log cause it’s a shared server. I will give 50 rep for anyone who helps me solve it.

Thanks

Related posts

Leave a Reply

1 comment

  1. In the parent htaccess, would this solve your situation or is it a nescessity for you to have access to /blog/ path from the dev.domain ?

    RewriteEngine on
    RewriteBase /
    RewriteCond %{HTTP_HOST}     ^dev.iber.co.uk$     [NC]
    RewriteCond %{REQUEST_URI}   ^/blog/              [NC]
    RewriteRule ^/blog/(.*)$     blog.iber.co.uk/$1   [R=302.L]
    ... other rules