I would really appreciate some help with a mod_rewrite, I know there is 64K answers on Stack Exchange about this topic and my answer is probably in there somewhere if only I could find the ones to put together to do this
These rules need to be fully and exactly implemented, without the risk of infinite loops, 500 errors or reduced server security.
NO browser redirect - so rewrite, is internal only ... browser bar remains unchanged
file_names.any_extension that do not exist redirect to /error/index.php whether non existent file is in html root or subdirs.
The following should be left untouched and exhibit default behaviour EXAMPLES:
URL/
OR URL/?bla-bla OR URL?bla-bla
OR URL/an_exist_file.ext
OR URL/an_exist_file.ext?bla-bla
OR URL/an_exist_file.ext/?bla-bla
AND all of above with an additional existing path such as:
URL/any_path_that_exists/an_exist_file.ext AND with OR without a query string.
HOWEVER the following should always rewrite internally to URL/?path_or_string_that_does_not_exist and $_SERVER[["REQUEST_URI"] should contain that non existent path // string; EXAMPLES:
URL/a_path_that_does_not_exist/
OR URL/a_string_that_is_not_an_existing_path (without trailing slash)
AND URL/a_path_that_does_not_exist/a_file_name_that_exists_in_html_root.ext is processed from html root and non existent path rewrites to a query string.
I hope that is clear. If anyone can help me with this it would be much appreciated. I have read all apache notes on subject (gave me a headache) and googled, looked up umpteen stack overflow articles, but was unable to come up with something to do all of the above reliably and together. Should be simple but for me it proving difficult.