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.

Problem with htaccess file

January 09, 2013 10:34pm

Subscribe [4]
  • #1 / Jan 09, 2013 10:34pm

    vacquah

    355 posts

    My htaccess code to remove index.php from my url is messing with an app I have on my server.  To access the app, I usually type:

    http://mydomain.com/appdirectory/

    However this is redirecting to my home page because of the index.php remove code. I know nothing about how the code works, but I have narrowed it down to the very last line in this code:

    # Remove index.php
    # Uses the "include method"
    # <a href="http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method">http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method</a>
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} ^/(archive|home|stories|videos||P[0-9]{2,8}) [NC]
    RewriteRule ^(.*)$ /index.php/$1 [L]

    if I comment it out like this, it works:

    # Remove index.php
    # Uses the "include method"
    # <a href="http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method">http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method</a>
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} ^/(archive|home|stories|videos||P[0-9]{2,8}) [NC]
    # RewriteRule ^(.*)$ /index.php/$1 [L]


    What exactly is that last line doing and how can I fix this? Thx.

  • #2 / Jan 11, 2013 2:41pm

    shotgunflat

    116 posts

    Hey Vacquah,

    Not sure what exactly that last line does, but I use this .htaccess code to remove index.php:

    <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>

    Perhaps that won’t affect your app (I know the same line is in there - but it may function differently and not affect your app)!

    Good luck,
    Drew

  • #3 / Jan 11, 2013 3:20pm

    vacquah

    355 posts

    Drew:

    Seems to be working! thank you!

  • #4 / Mar 21, 2013 10:42am

    stitchmedia

    1 posts

    This also solved my problems with Flexi Auth and a wonky .htaccess file immediately.  Thanks for this.

  • #5 / Apr 10, 2013 5:11am

    wafeeyhm

    1 posts

    Hi all,

    Im still currently having problem with the mod_rewrite. I’m currently using version 2.3.1. I tried everything, but i still get the index.php.

    Your feedback is highly appreciated. Thanks

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

ExpressionEngine News!

#eecms, #events, #releases