.htaccess - jpg url redirection htaccess -


after looking around, didn't find solution that… have website in html on vhost, put htaccess on it. here point :

portfolio here : wwwmydomainfr/photographies.html

the photos open in lightbox, can share these photos share button ex : wwwmydomainfr/photos/image1.jpg

what i'm looking redirect people wwwwmydomainfr/photographies.html when hit wwwmydomainfr/photos/image1.jpg

but thing cannot access photo if use redirection... "the requested content cannot loaded. please try again later"

for :

rewriteengine on rewritecond %{request_uri} \.(jpg)$ [nc] rewriterule ^(.*)/ wwwmydomainfr/photographies.html [l] 

i tried add without success :

rewritecond %{http_referer} !^http://(www.)?wwwmydomainfr/photographies.html [nc] 

any ideas ?

update

and also, when arrive url of image @ first, doesn’t work, when load again url, ideas ? looks it's kind of random redirection... sometime images not available too.. maybe can add in directory of images ?

the code @ end :

options +followsymlinks rewriteengine on rewritecond %{request_uri} \.(jpg)$ [nc] rewritecond %{http_referer} !^http://(www\.)?mywebsite.fr/photographies.html [nc] rewriterule ^(.*)/ http://www.mywebsite.fr/photographies.html [l] 

you're right try , use http_referer conditional because otherwise jpeg image resolves html file. without conditional request wwwmydomainfr/photos/image1.jpg, redirected wwwwmydomainfr/photographies.html, assume has image embedded <img ref='wwwmydomainfr/photos/image1.jpg'> tag, when browser tries retrieve image redirected html , not source of jpeg.

only thing can spot in rewrite condition not correct unescaped dot , inclusion of www in front of domain. try this:

rewriteengine on rewritecond %{request_uri} \.(jpg)$ [nc] rewritecond %{http_referer} !^http://(www\.)?mydomainfr rewriterule ^(.*)/ wwwmydomainfr/photographies.html [l]/photographies.html [nc] 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -