RewriteRule for URLs with spaces
- by Robert Cailliau
My site's pages are in multiple languages whereby each language version shares its media (images) with the other language versions. I place all versions and the media in a single directory with the same name. E.g. pages mypage-en.html, mypage-fr.html etc. will sit in directory mypage. The directory path suffices to reference a page:
h t t p : //....../mypage/
is good enough, there is no need for
h t t p : //....../mypage/mypage-en/html
A rewrite with
RewriteRule ^(.*)/([a-zA-Z0-9]+)/?$ /$1/$2/$2-en.html
lets me use the shorter form. But what if the name mypage contains spaces (which some do) ?
I want
h t t p : //....../my page/
to lead to
h t t p : //....../my page/my page.html
Using
RewriteRule ^(.*)/([a-zA-Z0-9|\s]+)/?$ /$1/$2/$2-en.html
did not work.
Any hints welcome.
(please do not ask me why I want to do this, nor tell me I should not use spaces in file names)