logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Redirect url to localhost/images
Author
newbieuser



Joined: 10 Oct 2013
Posts: 1
Location: india

PostPosted: Thu 10 Oct '13 19:27    Post subject: Redirect url to localhost/images Reply with quote

I have a simple app where i am currently downloading some images from the internet. I want to use a local web server to host some of these images when i am not connected to the internet. I installed the apache web server and added the images folder under htdocs - my document root.

Now, i want something like when i continue to query images from www.examplesite.com/xyzimage.png within my app, it should be redirected to localhost/images. Is this possible? I tried doing this

In C:\WINDOWS\system32\drivers\etc\hosts i added this line

www.examplesite.com/xyzimage.png localhost/images

Also in the httpd.conf i set the foll -

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?examplesite\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/examplesite
RewriteRule ^(.*)$ /images/$1 [L]

but it doesnt seem to work. Please help !
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Fri 11 Oct '13 16:06    Post subject: Reply with quote

in your hosts file you can't do a redirect! You can only set an IP for a domain.

e.g.
127.0.0.1 www.examplesite.com
127.0.0.1 another.com
Back to top


Reply to topic   Topic: Redirect url to localhost/images View previous topic :: View next topic
Post new topic   Forum Index -> Apache