Mobile app version of vmapp.org
Login or Join
Gloria169

: WAMP: Properly directing image paths on local server I'm using ExpressionEngine to build a site, and have a development version running locally via WAMP. Within the root "www" folder, I have

@Gloria169

Posted in: #Htaccess #Localhost #Wampserver

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 not work on the live server.

Thanks for any assistance here.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Gloria169

1 Comments

Sorted by latest first Latest Oldest Best

 

@Jamie184

You should really solve this by setting the DocumentRoot correctly on your local test server. Perhaps setup a VirtualHost for this test site, rather than changing your default server config if you are testing several sites? It is a local test server, so should reflect the settings of the live site as close as possible.

However, it is possible (but not recommended) to "fix" this with mod_rewrite in .htaccess. (Although if you have your own server then it will be more efficient in your server config, not .htaccess.) So, purely as an academic exercise, you could do something like:

RewriteEngine On
RewriteRule ^images/(.*) /ee/images/ [L]


This internally rewrites all requests for /images/ to /ee/images/. (This will obviously break your live site if accidentally uploaded.)

But, you are likely to have more problems with client-side paths... what about all your CSS and JavaScript files etc?

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme