Redirect old links example.com/oscthumb.php?src=/images/3-A_in.jpg&w=960&h=647&f=jpg&q=95&hash=6b

74 views Asked by At

I have indexed several images that I need to redirect using .htaccess

The old urls are like:

example.com/oscthumb.php?src=/images/3-A_in.jpg&w=960&h=647&f=jpg&q=95&hash=6b884jduhh3h8737h

and they have to become:

example.com/images/3-A_in.jpg

Images can have any image extensions and any file name. This part

oscthumb.php?src=/images/

is always the same.

I tried several options using .htaccess online testers but I'm unable to make it work.

1

There are 1 answers

1
Amit Verma On

To redirect the old URLs to new ones , you can use the following rule in your .htaccess file :

RewriteEngine on

RewriteCond ℅{THE_REQUEST} /oscthumb\.php\?src=/images/([^\s]+)\s [NC]
RewriteRule ^.+$ http://example.com/images/%1? [L,R]

Change R to R=301 to make the redirection permanent when you are sure the rule is working ok.