Lexsym Posted March 26, 2011 Share Posted March 26, 2011 Hi, I've recently moved all of the iamges stored on my website from "./" to "./images/" All of these images are embed across different forums, is there a rewrite that could be done so that the forum tags will get redirected to "./images/"? If I'm explaining it bad, this is what I mean: Forum post: [img=/1234abcd.png] Another forum post: [img=/4bc123.bmp] The other forum post: [img=/qwerty.jpg] And I want it so that when the "" tag is trying to view that file, it will actually be viewing the files: /images/1234abcd.png /images/4bc123.bmp /images/qwerty.jpg while keeping this original post intact. Link to comment https://forums.phpfreaks.com/topic/231743-rewrite-image-location/ Share on other sites More sharing options...
Lexsym Posted March 26, 2011 Author Share Posted March 26, 2011 I guess I can't edit the original post, but I also want to make it so that it will exclude the url "/upload/" and anything trailing. Link to comment https://forums.phpfreaks.com/topic/231743-rewrite-image-location/#findComment-1192377 Share on other sites More sharing options...
Spock Posted March 31, 2011 Share Posted March 31, 2011 This appears to be the forgotton part of the forum, been waiting nearly a week for somebody to reply to my post. Sucks eh Link to comment https://forums.phpfreaks.com/topic/231743-rewrite-image-location/#findComment-1194933 Share on other sites More sharing options...
betterphp Posted March 31, 2011 Share Posted March 31, 2011 you want to make ./image.png point to /images/image.png ?? RewriteRule ^([a-zA-Z_]+\.png)$ /images/$1 somethign like that might do it. Link to comment https://forums.phpfreaks.com/topic/231743-rewrite-image-location/#findComment-1194985 Share on other sites More sharing options...
Lexsym Posted April 3, 2011 Author Share Posted April 3, 2011 It works for the most part, except for when there is an image like this: ./O2mgk.png Is there a way to catch any combination of letters upper and lower, as well as number? Link to comment https://forums.phpfreaks.com/topic/231743-rewrite-image-location/#findComment-1196312 Share on other sites More sharing options...
betterphp Posted April 8, 2011 Share Posted April 8, 2011 yeah you would just have to add 0-9 to the character class, ie RewriteRule ^([a-zA-Z0-9_]+\.png)$ /images/$1 Link to comment https://forums.phpfreaks.com/topic/231743-rewrite-image-location/#findComment-1198741 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.