#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    376
    Rep Power
    14

    Rewrite images path


    i am moving to a different hosting. the hosting has a temporary URL like /~username/. All my database links to images are from the root folder. Is there a way in htaccess to tell the browser to read all paths like /images/image.gif to /~username/images/image.gif?

    I tried this, but it didn't work.
    Code:
    RewriteRule ^/images/([^/]*\.(gif|png|jpg))$ /~username/images/$1
    I also tried
    Code:
    RewriteBase /~username
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    376
    Rep Power
    14
    Didn't get an answer. Was wondering if someone can help me out with this?

    Originally Posted by ashabi
    i am moving to a different hosting. the hosting has a temporary URL like /~username/. All my database links to images are from the root folder. Is there a way in htaccess to tell the browser to read all paths like /images/image.gif to /~username/images/image.gif?

    I tried this, but it didn't work.
    Code:
    RewriteRule ^/images/([^/]*\.(gif|png|jpg))$ /~username/images/$1
    I also tried
    Code:
    RewriteBase /~username
  4. #3
  5. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,127
    Rep Power
    4304
    The first thing to try is removing the slash from the beginning of the new path:
    Code:
    RewriteRule ^/images/([^/]*\.(gif|png|jpg))$ ~username/images/$1
    If that doesn't work, you may need to find the complete file system path for that directory.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo