Mind blowing SEO improving and Google rank increasing Signature Rotator SEO Tool.

Thread: 

Rewrite all images to one?

Ads
banner
banner
Victor Dub Offline referral

Posts: 891
Joined: Oct 2013
Reputation: 4

#1
Posting Freak
How can I show one image for no matter what image name/file you request? In other words I have one image file let's call it default.png.

Now from HTML or where ever you call an image let's say hello.png.

I would like to show default.png image instead of hello.png keeping the URL of hello.png.

Simply replace the content BUT keeping the URL same!
marcus_avrelius Offline referral

Posts: 2,514
Joined: May 2013
Reputation: 105

#2
Support Team
You can use something like this to redirect all images!

Add this to your .htaccess file:

Code:
RewriteEngine on
RewriteRule ^images/(.*?)\.png$ image-rewrite.php?id=$1 [L,QSA]

Now create a php file called: image-rewrite.php

Add this code to it:

PHP Code:
<?php
$file 
'rewrite-image.jpg';
$type 'image/jpeg';
header('Content-Type:'.$type);
header('Content-Length: ' filesize($file));
readfile($file);
?>

Now every image that is called like this: images/anything.png will display this image: rewrite-image.jpg.
damponting44 Offline referral

Posts: 537
Joined: Oct 2016
Reputation: 0

#3
Senior Member
This snippet in your .htaccess will ensure that all requests for files and folders that does not exists will be redirected to index.php:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]





User(s) browsing this thread: 1 Guest(s)