Mobile app version of vmapp.org
Login or Join
Murray155

: RewriteRule for URLs with spaces 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

@Murray155

Posted in: #ModRewrite

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]+)/?$ ///-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]+)/?$ ///-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)

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Murray155

1 Comments

Sorted by latest first Latest Oldest Best

 

@Samaraweera270

You don't want the |s in your matching group. A plain space [a-zA-Z0-9 ] should be fine.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme