Image redirect
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Image redirect
Image redirect
01-08-2007 2:56 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
So, is this possible to do this in htaccess? To summarise, I want to redirect any requests for any images that are missing to a default image.
Thanks for any help.
PS. I'm not talking about hotlinking.
Re: Image redirect
01-08-2007 3:07 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Re: Image redirect
01-08-2007 3:17 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Options +FollowSymLinkswhich caused the server error until I commented it out.
Re: Image redirect
01-08-2007 3:52 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Re: Image redirect
01-08-2007 4:14 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I suppose what I really need to do is learn a bit about whatever language that script is written in so I can work out what I need to do. I'm alright with C++ but this is alien to me. Do you know what the language is?
Many thanks.
EDIT:
Found a list of the rules etc, seems a bit complex to start leaning for this one thing.
Perhaps someone could tell me what is wrong with this please:
RewriteEngine on
RewriteCond %{REQUEST_URI} !-U
RewriteRule /subdir/\.(gif|jpg|jpeg|png)$ default.png
where the htaccess file is in root (htdocs), the images are in subdir, and default.png is in root also.
I'm not sure whether you should start the path with a forward slash etc. but I've tried various combinations.
Thanks for any help.
Re: Image redirect
01-08-2007 5:01 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
RewriteRule \.(gif¦jpg¦jpeg|png)$ /default.png
Re: Image redirect
01-08-2007 5:03 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Quote from: Peter Try
RewriteRule \.(gif¦jpg¦jpeg|png)$ /default.png
With this would default.png need to be in the same directory as the htaccess file?
Re: Image redirect
01-08-2007 5:09 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
RewriteRule \.(gif|jpg|jpeg|png)$ /default.png
This still does not show the replacement image -- which has been uploaded before anyone asks

Thank you anyway.
@Peter, default.png is in the same directory as the htaccess file.
Re: Image redirect
02-08-2007 2:51 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thanks for any help.
Barry.
Re: Image redirect
02-08-2007 3:46 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
In my case all I want to do is check if a file exists (which works) and if it doesn't then rewrite to another directory.
Incidentally I'm fairly sure "alias" does work as I've used it, though its nothing like as powerfull as mod_rewrite.
Re: Image redirect
02-08-2007 4:10 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Re: Image redirect
13-08-2007 5:54 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I thank you.
Re: Image redirect
29-08-2007 1:28 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
It occured to me that a redirect would do what you're asking, and probably would work.
The rule would be something like:
RewriteRule \.(gif¦jpg¦jpeg|png)$ http://www.yourdomain.co.uk/default.png [L,R]
The difference is that with the
Re: Image redirect
29-08-2007 5:19 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I appreciate you trying to help. I just tried that with
Re: Image redirect
30-08-2007 12:26 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I know the above would be a bit messy but at least it should fix it for now.
Ian
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page