Prashant Patel Prashant Patel - 7 months ago 27
Apache Configuration Question

redirect URL with and without closing SLASH (symbol)

I need to redirect

please see my code

Redirect 301 /folder1/ /file.html

this code only matches
and ignores urls without closing
how can I make it work in both cases with and without
. Without having to repeat code twice!?

I also need it to NOT be case sensitive.

thank you sir


You can use RedirectMatch and make the trailing slash optional using ? char

RedirectMatch 301 ^/folder1/?$ /file.html