February 14th, 2012, 03:47 AM
-
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
February 19th, 2012, 08:29 AM
-
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
February 19th, 2012, 04:10 PM
-
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.