Hello guys can someone help me with an simple advice on how can I redirect all html files in website to virtual folders with the same name. exemple: /building.html -> /building/ I have this code in .htaccess: Options +FollowSymLinks RewriteEngine on RewriteRule ^([^/\.]+)/?$ $1\.html [L] RewriteRule ^([^/\.]+)?\.html$ /$1/ [NC,R=301] - this line doesn't work waiting for your advices. Thanks
your below example UN-clear or wrong! YOU rewrite to filename again - whereas it appears that you want to rewrite to folder ONLY without filename !!?? below are both solutions - both are tested and work on my server 1. redirect file_name.html to /folder_name/file_name.html where file_name = folder_name Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteRule ^([^/\.]+)?\.html$ /$1/$1\.html [L,R=301] OR 2. redirect file_name.html to /foldername/ WITHOUT any html page-redirect just to folder as you specified originally: Options +FollowSymLinks RewriteEngine on RewriteBase /var/ RewriteRule ^([^/\.]+)?\.html$ /$1/ [L,R=301]