Forum Moderators: phranque
YOu could also use mod_rewrite to append the slashes where needed, *if* the case where you need to add a slash is easy to identify in a consistent manner.
You may use any kind of file or script as an ErrorDocument, but if the search engines are consistently listing your URLs without a slash, then it would be a very bad idea to use a 404 response to handle these requests -- Your pages would rightly be removed from the search index because your server would be saying they don't exist.
I recommend handling the 'fix-up' entirely within your server, without using a 404 response.
If you provide more details on the type of resource that these missing-slash URLs refer to, we may be able to give you more focused recommendations. Are they directories, pages, or scripts? Are they consistently named and consistently-identifiable? Do they all reside in some easily-identifiable subdirectory? Anything that can be used to classify them might be helpful.
Also, WHY does your site "need" that trailing slash? -- It might be far simpler and more efficient to fix that, rather than to implement a work-around.
Jim
RewriteEngine On
RewriteRule ^(.+/)$ index.php?c=/$1 [L]
I added the following as a temporary fix so it displays the index page when it is messed up.
ErrorDocument 400 /dir/
ErrorDocument 404 /dir/
All I really want it to do is add the extra / when needed. the only other file it calls within the /dir/ folder is a CSS i could move elsewhere. so if anything was called within the path /dir/ I would want to make sure it ended with /. If you were able to find my direcotry or go the farfarfar website and look at there demo's you could go to a sub page and erase the ending slash and you would see the throw errors. Anyhow thanks for the help thus far. What is my best course of action?
RewriteEngine On
RewriteRule ^(.+)/?$ index.php?c=/$1/ [L]
Jim
ErrorDocument 404 ^(.+/)$ /dir/index.php?c=/$1/
or can I chage my rewrite so regardless of what gets called it will try to rewrite?