问题
I am a newbie.. My htaccess now has
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
# /viewgallery.php?cname=Colorado-Fall&pcaption=Poked to /photos/Colorado-Fall/Poked.jpg
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+viewgallery\.php\?cname=([^&]+)&pcaption=([^&\s]+) [NC]
RewriteRule ^ /photos/%1/%2.jpg? [R=302,L,NE]
RewriteRule ^photos/([^/]+)/([^.]+)\.jpg$ /viewgallery.php?cname=$1&pcaption=$2 [QSA,L,NC,NE]
And redirect works but the images will not show up on my pages if they are not in the root folder. If I have a sub directory created with images(for organizing them), they will create an error as 'images not found'.
Is there a solution for this? Thank you for any suggestions....
回答1:
This is probably a relative/absolute URL thing. Try adding a relative URI base to the header of your page:
<base href="/" />
Or whatever the correct base should be. Either that, or change all your links to absolute urls:
From:
<img src="subfolder/banner.jpg">
to:
<img src="/subfolder/banner.jpg">
来源:https://stackoverflow.com/questions/18780562/images-wont-show-after-redirect-using-htaccess