Jens Törnell
Jens Törnell

Reputation: 171

htaccess change image php extension to png?

I have a WordPress installation. I have an image on this path:

http://www.somedomain.com/wp-content/themes/twentytwelve/image.php

Is it possible to link / rewrite it to this path instead?

http://www.somedomain.com/wp-content/themes/twentytwelve/image.png

Htaccess could be fine. Maybe match /image.php?

Upvotes: 0

Views: 688

Answers (2)

Aditya P Bhatt
Aditya P Bhatt

Reputation: 22071

You can try something like this:

Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteRule ^(script)/([^.]*)\.php$ $1/image.png [L]

hopefully it will help you achieve you looking for. Forgive me for any syntax error.

Upvotes: 0

Ben Fortune
Ben Fortune

Reputation: 32117

Try this in a .htaccess file:

RewriteEngine On
RewriteRule ^(.*)\.php$ $1.png

Upvotes: 1

Related Questions