I have the following link
www.site.com/img.php?=http://external.link/image.jpg
what should look like
www.site.com/img/image.jpg
Can I make a rule with htacces to override the wrong link? without a redirect being seen in the url bar
Yes you can,
You just have to put the code below in your .htaccess
file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^img/([a-z0-9_-.]+)/?$ img.php?p=$1 [NC,L]
</IfModule>
And then you can implement the following piece of code in your img.php
page
if ( isset($_GET['p']) ) {
printf(
"<img src=\"http://external.link/%s\" alt=\"\">",
htmlspecialchars($_GET['p'])
);
}