tpl41803 Posted March 13, 2009 Share Posted March 13, 2009 Hi all, Someone helped me out with this short .htaccess issue a while back on this form, and it seems that I never actually solved my problem so here it is again: I wanted to write a script that would replace any broken images -- images that are "not found" -- with a default image that says "image not found" -- the site I work on lists used cars for sale and unfortunately the guy who updates the site doesn't always upload pictures when he lists the new cars in the inventory. Thus, I want this default image to display until he gets around to uploadin the actual images I was directed to do this through .htaccess using the rewrite engine -- here's what I'm using currently: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f [NC] RewriteCond %{REQUEST_FILENAME} !-d [NC] RewriteRule ^(.+)$ /image/noimg.jpg it works perfectly, except that when I log back into my file manager, I am presented with a "403 Error, Access Denied" I have tried several different things to amend this-- I've removed the "rewriteengine on" line, and the images don't get replaced ,but the 403 error goes away. also in my .htaccess i have custom redirect pages, they're in there below the rewrite rules: Options -Indexes ErrorDocument 401 /customerrors/error_401.php ErrorDocument 403 /customerrors/error_403.php ErrorDocument 400 /customerrors/error_400.php ErrorDocument 500 /customerrors/error_500.php ErrorDocument 404 /customerrors/error_404.php any help would be appreciated, thank you! Quote Link to comment https://forums.phpfreaks.com/topic/149276-solved-rewriteengine-on-causing-403-error/ Share on other sites More sharing options...
Jagarm Posted March 14, 2009 Share Posted March 14, 2009 Try the following and let me know if it works for you: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$ RewriteRule .* /notfound.jpg [L] It works fine for me. Quote Link to comment https://forums.phpfreaks.com/topic/149276-solved-rewriteengine-on-causing-403-error/#findComment-784676 Share on other sites More sharing options...
tpl41803 Posted March 14, 2009 Author Share Posted March 14, 2009 thanks for the response it works, but i still get the 403 error when i turn the rewrite engine on i really have no idea what the issue is :-\ Quote Link to comment https://forums.phpfreaks.com/topic/149276-solved-rewriteengine-on-causing-403-error/#findComment-784683 Share on other sites More sharing options...
tpl41803 Posted March 16, 2009 Author Share Posted March 16, 2009 sorry to waste everyone's time i contacted my server host and they fixed the issue--it was something on their end, everything's working as intended thanks! Quote Link to comment https://forums.phpfreaks.com/topic/149276-solved-rewriteengine-on-causing-403-error/#findComment-786067 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.