I would like to rewrite a URL such as
I have tried something like this:
RewriteRule ^$ /en [R=301]
It can redirect me from
https://example.com/en/; but it fails when my URL is
https://example.com/abcde, keeping the original URL.
What should I write in the config file?
I have probably missed to state that there are other subdirectories under the root and I still need to keep access, such as
Lastly, I don't want to keep the URL unchanged. I need it to be changed as well. I don't mind to use 'RedirectMatch' rule.
For better understanding:
https://example.com/abcde ==> https://example.com/en/abcde
https://example.com/zh/abcde #KEEP! (in which subdirectory "zh/" exists)
https://example.com/en/ffsd #KEEP! (in which subdirectory "en/" exists)
https://example.com/hub/iyukmyjnrtb #KEEP! (in which subdirectory "hub/" exists)
Thanks a lot!
Sorry for any misunderstanding. I also need the redirection for the following:
https://example.com/abcde/edgs ==> https://example.com/en/abcde/edgs (in which subdirectory "abcde/" does not exists)