0

I'm using ExpressionEngine to build a site, and have a development version running locally via WAMP. Within the root "www" folder, I have an "ee" subdirectory that acts as the root of the development site. There is an "images" folder directly within "ee" that contains all images for the site. On the live server, the image paths require "/images/...", however on my dev server, if I use the same path it will map to "localhost/images/..." not "localhost/ee/images..." and therefore result in broken links.

I'm wondering if there's an adjustment I can make to the .htaccess file to get the links mapping properly on my local server? At this point, in order to get images to show, I need to use "images/..." which will, in turn, not work on the live server.

Thanks for any assistance here.

1

It's more a Wamp problem that an EE one,

But open this file, inside your wamp install:

wamp/bin/apache/conf/extra/httpd-vhosts.conf

edit it and add (have to put path of your local site here: wamp/bin/apache/conf/extra/httpd-vhosts.conf :

<Directory "D:/local_site_directory/www/site_name">
   # maybe there is some comments here ...
  Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Require all granted
</Directory>

<VirtualHost *:80>
    DocumentRoot "D:/local_site_directory/www/site_name"
    ServerName mysitename
</VirtualHost>

You have to remove the # in one line in wamp/bin/apache/conf/httpd-vhosts.conf:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Restart wamp, and if you entered the right path, it would work. This setting is working with the last wamp version ,perhaps not will work in more older ones.

1
  • Thanks Stephane; I will give this a shot and report back. – nickpish Nov 16 '14 at 5:40
1

You could also update the config.php file where the image paths are set, see ee docs regarding this migration process.

https://docs.expressionengine.com/latest/operations/moving.html

1

Agree with Lloyd_07.

In addition, if you have got the time, you could setup environments https://github.com/focuslabllc/ee-master-config/tree/EE3

But if you dont want that, just a if else in config.php

for ex.

if ($_SERVER['HTTP_HOST'] == "example.com") {
$config['cp_url'] = 'https://example.com/admin.php';
    $config['theme_folder_url'] = 'https://example.com/themes/';
    $config['theme_folder_path'] = '/home/examplecom/public_html';
    $config['site_url'] = 'https://example.com/';
}

You can make it more complex as you like. This works well for localhost settings and one environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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