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.

How to ignore specific subdirectories?

March 26, 2010 10:24am

Subscribe [1]
  • #1 / Mar 26, 2010 10:24am

    MCrittenden

    67 posts

    I have an ExpressionEngine site at http://example.com and a WordPress blog at http://example.com/blog (not my choice to be using both simultaneously, but I’m stick with it). The problem is, any WP pages that don’t map directly to an index.php end up being handled by ExpressionEngine, which results in a 404.

    For example, http://example.com/blog and http://example.com/blog/wp-admin both work fine as they both directly use an index.php in those folders, but http://example.com/blog/category/tag/something gets handled by ExpressionEngine. So how can I modify the ExpressionEngine .htaccess file to tell it to ignore anything in the /blog directory? Or is there something else I should to here?

    Here’s what’s currently in the ExpressionEngine .htaccess file:

    Options +FollowSymLinks
    RewriteEngine On
    
    ##### Remove index.php ######################################
    RewriteCond %{REQUEST_URI} !^/blog
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]
    
    ##### Add WWW ###############################################
    RewriteCond %{REQUEST_URI} !^/blog
    RewriteCond %{HTTP_HOST} ^getregionalcash.com [NC]
    RewriteRule ^(.*)$ <a href="http://www.getregionalcash.com/$1">http://www.getregionalcash.com/$1</a> [R=301,NC]
    
    ##### Increase File Limit Size ##############################
    #set max upload file size
    php_value upload_max_filesize 20M
    
    #set max post size
    php_value post_max_size 20M
    
    #set max time script can take
    php_value max_execution_time 6000000
    
    #set max time for input to be recieved
    php_value max_input_time 6000000
    
    #increase php memory limit
    php_value memory_limit 64M

    As you can see, I already made a couple attempts at ignoring /blog but it didn’t work. Any ideas?

  • #2 / Mar 26, 2010 11:59am

    ender

    1644 posts

    perhaps remove the slash before blog to see if that makes any difference

    ie:

    RewriteCond $1 !^(index\.php/)?blog [NC]
  • #3 / Mar 26, 2010 12:05pm

    MCrittenden

    67 posts

    @Ty, thanks for the reply. Unfortunately, that didn’t seem to help.

  • #4 / Mar 26, 2010 12:43pm

    ender

    1644 posts

    maybe it’d be best to try a different method of removing index.php from the URL.

    instead of:

    RewriteCond %{REQUEST_URI} !^/blog
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]

    try:

    RewriteCond $1 !^(blog|images|system|themes|favicon\.ico|robots\.txt|index\.php) [NC]
    RewriteRule ^(.*)$ /index.php/$1 [L]

    add any other directories and files that you need to ignore to the pipe-separated list.

  • #5 / Mar 26, 2010 12:48pm

    MCrittenden

    67 posts

    Hmm, your last solution didn’t seem work either. That’s just weird. Here’s my .htaccess now:

    Options +FollowSymLinks
    RewriteEngine On
    
    ##### Remove index.php ######################################
    RewriteCond $1 !^(blog|images|system|themes|resources|favicon\.ico|robots\.txt|index\.php) [NC]
    RewriteRule ^(.*)$ /index.php/$1 [L]
    
    ##### Add WWW ###############################################
    # COMMENTED OUT TO ENSURE THIS ISN'T CAUSING PROBLEMS
    # RewriteCond %{HTTP_HOST} ^website.com [NC]
    # RewriteRule ^(.*)$ <a href="http://www.website.com/$1">http://www.website.com/$1</a> [R=301,NC]
    
    ##### Increase File Limit Size ##############################
    php_value upload_max_filesize 20M
    php_value post_max_size 20M
    php_value max_execution_time 6000000
    php_value max_input_time 6000000
    php_value memory_limit 64M

    Any ideas? Could there be something outside the realm of .htaccess that’s screwing this up?

  • #6 / Mar 26, 2010 1:02pm

    MCrittenden

    67 posts

    I also tried this, which also isn’t working:

    Options +FollowSymLinks
    RewriteEngine On
    
    ##### Add WWW. ######################
    RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
    RewriteRule ^(.*)$ <a href="http://www.domain.com/$1">http://www.domain.com/$1</a> [R=301,L]
    
    ##### Allow access to WordPress. ########################
    RewriteCond %{REQUEST_URI} ^/blog
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /blog/index.php/$1 [L]
    
    ##### Leave the rest for EE. #######################
    RewriteCond %{REQUEST_URI} !^/blog
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]
    
    php_value upload_max_filesize 20M
    php_value post_max_size 20M
    php_value max_execution_time 6000000
    php_value max_input_time 6000000
    php_value memory_limit 64M
  • #7 / Mar 26, 2010 1:33pm

    ender

    1644 posts

    yeah dunno, would have to get in there and play around to really get a feel for what is causing the problem.  I copy/pasted that last one directly from a working install of my own… unfortunately there’s about as many different ways to configure a webserver as there are people who’ve set up a webserver before 😉

  • #8 / Mar 26, 2010 2:34pm

    MCrittenden

    67 posts

    Got it working. Like an idiot, I had left WP’s own .htaccess trying to use EE’s index.php instead of its own (i.e., it was going for /index.php instead of /blog/index.php). Changing that combined with your solution above fixed it. Thanks!

  • #9 / Mar 26, 2010 2:43pm

    ender

    1644 posts

    cool 😊

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases