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 with ee root in subfolder

March 28, 2012 6:22pm

Subscribe [2]
  • #1 / Mar 28, 2012 6:22pm

    Sr. Coffee

    97 posts

    This question may be related to a resolved thread.

    Alas, I have been tried many approaches but have been unable to find the .htaccess recipe that will enable me to remove the index.php from the url… I know this has to be a favorite topic around the shop, but if anyone feels like helping, I’d be much obliged.

    I set up ee in a subfolder, ‘/ee’. I have an .htaccess file in the public_html directory that routes all traffic to the subfolder. (site is on bluehost.) The site is up and running in that location. I have placed various versions of the .htacess files for index.php removal in the /ee directory, as described in the post cited above, removed the index page designation in the General Configuration, did and did not remove “ee” from the ‘URL to the root directory of your site’ configuration (didnt know what to do there). Could never find the right combination of ‘?’ or no ‘?’, etc.

    With the code below, I would just get a blank page.

    .htaccss in root:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?worldsci.net$
    RewriteCond %{REQUEST_URI} !^/ee/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /ee/$1
    RewriteCond %{HTTP_HOST} ^(www.)?worldsci.net$
    RewriteRule ^(/)?$ ee/index.php [L]

    .htaccess in /ee:

    # Use PHP5 Single php.ini as default
    AddHandler application/x-httpd-php5s .php
    
    RewriteEngine On 
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    Finally, for future reference, what is the recommended strategy for developing and testing on a live domain, if using a subdirectory is a problem?

    Thanks/

  • #2 / Mar 29, 2012 3:53pm

    Shane Eckert

    7174 posts

    Hey Sr. Coffee,

    Love the name.

    I am sorry to hear you are running into this snag.

    We really only suggest one configuration for removal of 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>

    I can move this over to the Community Help Forum if you would like. You may get a good bit of direction on this.

    I would suggest also taking a look at this article. It’s very informative.

    Cheers,

  • #3 / Mar 30, 2012 11:49am

    Sr. Coffee

    97 posts

    Yes, please move to the community forum. thanks.

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

ExpressionEngine News!

#eecms, #events, #releases