regex - How do I redirect all requests for .html files to directories with respective names? -


first question grace appreciated! have site use have tens of thousands of .html files index.html files inside directories. example, file1.html has become /file1/ (/file1/index.html). don't want spend inodes on individual files this, hoping it'd possible in htaccess file. suppose it'd have test existence of directory isn't possible right?

add .htaccess in web root / directory

rewriteengine on  rewritecond %{document_root}/$1 -d # dir exists? rewriterule ^(.*)\.html$ /$1/ [r=301,l] 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -