Prashant Patel Prashant Patel - 1 year ago 88
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

Answer Source

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

RedirectMatch 301 ^/folder1/?$ /file.html
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download