ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

htaccess for EE in root and wordpress in subdirectory

June 13, 2012 12:25pm

Subscribe [1]
  • #1 / Jun 13, 2012 12:25pm

    Having trouble getting the 2 to play nice together… Client wants to keep their existing Wordpress blog for now which lives in a subdirectory: /blog. When I add the usual htaccess code to remove the index.php from EE in the root, I can still access the blog home, but any deep urls get routed back to EE. Here’s what I have tried from suggestions I’ve seen online:

    root htaccess:

    <IfModule mod_rewrite.c>
    
    RewriteEngine On
    RewriteBase /blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]
    
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]
    
    </IfModule>

    blog htaccess:

    Options All -Indexes
    <IfModule mod_rewrite.c> 
        RewriteEngine On
        RewriteBase /
        RewriteCond $1 !^(index\.php) [NC]
        RewriteRule ^(.*)$ /blog/index.php/$1 [L]
    </IfModule>
  • #2 / Jun 14, 2012 2:45pm

    Update: have the issue resolved on local machine:

    root htaccess:

    <IfModule mod_rewrite.c>
            RewriteEngine On
    
            # Removes index.php
            RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ /index.php/$1 [L]
    
            # If 404s, "No Input File" or every URL returns the same thing
            # make it /index.php?/$1 above (add the question mark)
    </IfModule>

    blog htaccess:

    # 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
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases