Common problem, but too complicated for me.
Here are the requirements I am trying to meet:
- The root URL http://example.com should be redirected to http://www.example.com
- All URLs like http://example.com/c/1234567890 should be redirected to http://www.example.com/c/1234567890 (notice the "c" fake subdirectory)
- When entered http://example.com/index.php one should be redirected to http://www.example.com (no trailing slashes)
- On top of that I'm trying but failing to secure a subfolder "xy" from direct access exept from php files in root and javascript files.
I searched a lot and tried a lot of rewrite conditions and rules, but htaccess+regex is just from another planet for me. :/ Sorry if this is a duplicate…