I’ve search the internet and Stackoverflow for hours now and I just can’t fix my problem completely. I already figured it out years ago, but lost the file and I can’t reconstruct it anymore. So I’m hoping for your help!
I’ve HTML-URLs and I want to simulate folders AND I also want to remove the extension .html
INPUT: domain.com/file.html
OUTPUT: domain.com/file/
INPUT: domain.com/folder1_folder2_file.html
OUTPUT: domain.com/folder1/folder2/file/
I’m also not so sure about the flags at the end of the line.
Notworking code so far:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1 [R=301,L]
RewriteRule ^([^_]*)_(.*)$ $1/$2 [R=301,L]
RewriteRule ^([^_]*)?_([^_]*)?_(.*)$ $1/$2/$3 [R=301,L]
Thanks for your help.
2
Answers
Finally I have figured it out myself. It rewrites URLs with non-digit characters and dashs.
For anyone interested:
Nevertheless, thank you for your efforts =) @RavinderSingh13
Could you please try following.
Testing with curl command: