Page 1 of 1

Mod rewrite with the file extensions

Posted: Sat Apr 10, 2010 10:21 am
by lauthiamkok
Hi,

I have pictures kept in the folder like this http://www.mywebsite.com/img_content/extra/

there are list of pictures like,

1_20100321104422.jpg
hp_20100321104555.jpg
ep_m_2010032113455.gif

so I want to rewrite the url from, for instance,
http://www.mywebsite.com/img_content/ex ... 104555.jpg
to
http://www.mywebsite.com/wallpapers/hp_ ... 104555.jpg

which mean you only see this on your browser url,
http://www.mywebsite.com/wallpapers/hp_ ... 104555.jpg

this is my code in .Htaccess file but it won't work,

Code: Select all

RewriteRule ^wallpapers/([a_zA_Z0_9]+)\.(jpg|gif)$  /img_content/extra/$1.$2 [L]
Many thanks if you have any ideas.

Cheers,
Lau

Re: Mod rewrite with the file extensions

Posted: Sat Apr 10, 2010 1:47 pm
by requinix
[a_zA_Z0_9]

You're using underscores...

Re: Mod rewrite with the file extensions

Posted: Sat Apr 10, 2010 2:03 pm
by lauthiamkok
got it! have changed that and it is now working thanks. :D