问题
how are you? please one very little question if you don't mind.
after the previous episode of redirecting and rewriting rules in this thread: redirect to default language except for /amp/ Urls, our SEO agency recommended us to change the URLs site.com/fr, site.com/be to site.fr and site.be
I already set the 301 redirections for old URLs as follow:
RewriteRule ^[a-z]{2}$ / [R=301,L]
RewriteRule ^[a-z]{2}/(.*)$ /$1 [R=301,L]
I know this can be achieved in one rule but didn't manage to make it work :/
since I now removed the language folder, removing the trailing slash does't really work well. site.com/test adds the slash because the folder "test" exists and is a real folder. I tried DirectorySlash Off but it returns a forbidden 403 error. please any idea how to solve this?
Thanks a lot
回答1:
Following my comments:
Combining those 2 shown rules into one:
RewriteRule ^[a-z]{2}(?:/(.*))?$ /$1 [R=301,L,NE]
来源:https://stackoverflow.com/questions/53635598/remove-trailing-slash-from-real-directories