Apache: Map the example.com/12345.html URL on filesystem to /var/www/html/1/2/3/4/5/12345.html
So every letter of the URL after the example.com is a subfolder under /var/www/html. How can I solve this?
Edit: it should hande the url size dynamically, so it should work with /1/2/12.html too
Edit2: My attempt:
ScriptAliasMatch "^/([a-zA-Z0-9]+)([a-zA-Z0-9]+)([a-zA-Z0-9]+)([a-zA-Z0-9]+)([a-zA-Z0-9]+).html" "/$1/$2/$3/$4/$5/$1$2$3$4$5.html"
but it doesn't work...
Edit3: OK It works, but with only 5 characters in the url: /12345.html
RewriteRule "^/([a-zA-Z0-9]+)([a-zA-Z0-9]+)([a-zA-Z0-9]+)([a-zA-Z0-9]+)([a-zA-Z0-9]+).html" "/var/www/html/$1/$2/$3/$4/$5/$1$2$3$4$5.html"
How can I make it dynamically?
Edit3: This is my new attempt:
RewriteEngine on
RewriteRule "^/([a-zA-Z0-9]+)([a-zA-Z0-9]+)([a-zA-Z0-9]+)([a-zA-Z0-9]+)([a-zA-Z0-9]+).html" "/var/www/html/$1/$2/$3/$4/$5/$1$2$3$4$5.html"
RewriteRule "^/([a-zA-Z0-9]+)([a-zA-Z0-9]+)([a-zA-Z0-9]+).html" "/var/www/html/$1/$2/$3/$1$2$3.html"
RewriteRule "^/([a-zA-Z0-9]+)([a-zA-Z0-9]+).html" "/var/www/html/$1/$2/$1$2.html"
Do I need to create a rule for every URL length? 3 to 20?