NameSilo

.htacess image redirects

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Watch

newsiness

VIP Member
Impact
49
Last edited:
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
something like the following should do it (untested)

RewriteEngine on
RewriteRule ([/-a-zA-Z0-9]+)/(.*)\.png$ /images/{$2}.png [L]
 
0
Close
Peter said:
something like the following should do it (untested)

RewriteEngine on
RewriteRule ([/-a-zA-Z0-9]+)/(.*)\.png$ /images/{$2}.png [L]

tested. not working.
 
0
Close
newsiness said:
Hi,

In the html page, there are a links to the the same image for example
http://abc.com/***/***/images/XYZ.png -->(case1)
*** indicates variables.

I have XYZ.png file which is located at http://abc.com/images/XYZ.png -->(case2)

In the .htaccess, how to redirect (case1) to (case2)?

Please advice and Thanks in advance!!!

Try this:
Code:
RewriteEngine On
RewriteRule ^(.*)/(.*)/images/(.*) images/$3 [L]
 
0
Close
Slightly different from above:

Code:
RewriteRule ^([A-z0-9]+)/([A-z0-9]+)/images/([A-z0-9]+)\.png$ /images/$3.png [L]

The difference is only addresses like

HTML:
http://yoursite.com/ABCdef/GHij123/images/68qowg.png

Will redirect. With the one above so would

HTML:
http://yoursite.com/AB/Cd/ef/GHij/1/23/images/68qowg.png
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back