Search code examples
.htaccessurl-rewritingexpressionengine

Exclude subdirectory from Expression Engine official .htaccess index redirect


I have found a great number of suggestions online, but none of them seem to work in my case. I have an Expression Engine install in the root of my site. In a subdirectory named "helpone", I have installed WordPress.

The Expression Engine .htaccess is redirecting domain.com/helpone so that I can not access my WP install.

In EE's root .htaccess, the following official rule is used to handle the EE file system:

<IfModule mod_rewrite.c>

RewriteEngine On

    # Removes index.php from ExpressionEngine URLs
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]

</IfModule>

I need to add an exclusion, so that when users go to domain.com/helpone -- it functions like a normal WP site.

What exact rule or condition to I need to add and on what line do I need to place it?

Thanks in advance for your help.

UPDATE 5/23

The problem, in my case, was caused by a weird Hostgator issue. I had a password set on my WP directory because it was in development. When I added any exclusion that would let me pass through to the WP install, it would kill all the navigation on the root site. None of the links would work anymore. I ended up leaving both the EE .htaccess and the WP .htaccess alone (I didn't add an exception), but removing the password from the WP /helpone directory, and it worked fine.


Solution

  • # ExpressionEngine
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^helpone
    RewriteRule ^(.*)$ /index.php/$1 [L]
    
    # WP
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^helpone
    RewriteRule .? /helpone/index.php [L]