treehouse : what would you like to learn today?
Web Design Web Development iOS Development

htaccess help needed !

  • Hi
    I have copied my WP site from www.domain.org (database included etc..) to my home server for further local development.
    New local IP is: 192.168.1.xxx/MB
    Every thing is working well except none of my images located on original site in /wp-content/files/xxx.jpg are showing on local server (image not found of course)
    I am pretty sure I can use htaccess file to solve this problem but have not succeded so far
    Can I use something like :
    Redirect 301 /wp-content/files 192.168.1.xxx/MB/wp-content/files/
    This doesn't work !
    Anybody any ideas ?
    Thanks for help
    Regards from France
  • Install a plugin called Velvet Blues Update URLs. You can change all of the URLs on your local copy.
  • Thanks
    Will give it a try and keep you posted on how it works
    Changing all URLs on local copy is to much to do as I have over 150 links to modify
  • Unfortunatly Velvet Blues Update doesn't do the trick in this particular case
  • What doesn't it change? It has worked flawlessly for me on many occasions.
  • All images are referenced in original site: src="/wp-content/files/onu-s.jpg"
    Original site is in root folder
    Local site : 192.168.1.190/MB
    Images are located in folder: 192.168.1.190/MB/wp-content/files/
    MB is just a sub-folder
    I havn't succeded with suggested plugin this is why I think htaccess redirect instructions might be a better answer. Or may be I didn't use plugin the correct way !
    Thanks for help
  • Aaahhh, so it's a relative link... interesting, as WordPress never does it like that. Is this something that you've hard coded into a template or you've modified the src URLs in the actual WordPress pages?

    I don't know enough about htaccess to provide you with a solution there.
  • it is definitly a relative link that I have hard coded into all posts with thumbnails
    To improve my coding practices how do you recommand I should code these src URLs in the future.
    Thanks for help
  • I've had the same problem that I can never get images into a template with HTML. I just use a div with a background of the image, and that does work for some reason.
  • Have you hardcoded it into a template (single.php, page.php, etc) or have done on a post by post basis?