Unstoppable Domains

.htacess image redirects

Spaceship Spaceship
Watch

newsiness

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

RewriteEngine on
RewriteRule ([/-a-zA-Z0-9]+)/(.*)\.png$ /images/{$2}.png [L]
 
0
•••
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
•••
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
•••
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
•••

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back