Forum Moderators: phranque

Message Too Old, No Replies

redirect image url from localhost to working domain

         

paonza

1:40 pm on Jun 7, 2012 (gmt 0)

10+ Year Member



Hi All!
I need to redirect by mod rewite images url from:
http://192.168.0.10:123/localsite/images/mypic.jpg

to
http://www.mydomain.com/images/mypic.jpg


how to do this?
thank you for your help!

lucy24

6:04 pm on Jun 7, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Well, what have you tried so far?

:: memo to self: write that ### boilerplate I keep saying I'm going to write ::

Crucially: Where do the images actually live? Where is the html located? How does it currently call the images?

I kinda suspect that you've got a problem other than simple URL replacement.

paonza

10:58 am on Jun 8, 2012 (gmt 0)

10+ Year Member



no, I have the site content stored into a mysql db.
I have added text and image localy and all the path as been stored with the local path!
Then I upload the site online and the contents still point to the local path!
I have to replace each single path inside the database or replace them by a mod rewrite, isn't it?

thx!

g1smd

4:26 pm on Jun 8, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Then I upload the site online and the contents still point to the local path!

If that "local path" includes
http://192.168.0.10:123/
then mod_rewrite cannot help you at all.

If the requests are for
http://www.example.com/localsite/images/mypic.jpg
then one line of code using a RewriteRule can redirect those requests to
http://www.example.com/images/mypic.jpg


However, having links within a site that redirect is very bad form so you will still have to edit that database to fix the paths.