2

I've got EE running in a subfolder on a dev environment, such as:

http://website.com/folder_name/

But somehow, the folder keeps being removed from the URL for certain things. E.g. the "Home" icon on the home button in EE errors, because the URL looks like this:

/themes/cp_themes/default/images/home_icon.png

Not:

/folder_name/themes/cp_themes/default/images/home_icon.png

How can I fix this? There is no .htaccess file at the moment

3 Answers 3

1

You need to delete this out of your .htaccess when accessing EE from a sub folder:

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
    </IfModule>
1
  • You could also rewrite the base to include the sub folder than just removing it. Mar 17, 2014 at 14:14
1

There's a configuration value for the location of your themes directory. By default, in EE you'd change those by going here in the EE control panel:

Admin > General Configuration > URL to your "themes" folder

Eventually, many developers start setting configuration options like that in their config.php file; in this case, $config['theme_folder_path']and $config['theme_folder_url'] would be the applicable items. Delving into auto-setting dev/staging/production settings in config.php is beyond the scope of this post, but, is something you'll probably want to look into, if you haven't already.

2
  • Yeah, I checked that and all is good. The theme folder is correct in there but it just seems to be removing the "folder_name" bit of the URL. It's like .htaccess is doing something, or the server itself.
    – Jason Mayo
    Jan 13, 2014 at 15:02
  • Are you seeing the correct URL when you do a view source? Do you have another copy of EE installed in the root directory? Jan 13, 2014 at 15:23
1

Sounds like your .htaccess file needs to account for your subfolder when removing index.php for EE. Here's a code snippet you can use.

<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 YOU HAVE WEBSITE IN A SUB FOLDER: comment out above line, uncomment below line, & replace 'SUBFOLDERNAME'
    RewriteRule ^(.*)$ /SUBFOLDERNAME/index.php/$1 [L]

</IfModule>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.