@Technical.Legendz Try this:
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} /folder1/([^\s?]*) [NC]
RewriteRule ^ %1 [L,NE,R=302]
RewriteRule ^((?!folder1/).*)$ folder1/$1 [L,NC]
@Greenreader9 He is not asking for redirection but hiding the folder name in url but also keeping the files in that folder. This is a technique for two things:
- When your application requires a specific folder to be the root of your files but you don’t have the permission to change it.
- While proxying http servers which are powered with something like node.js, python etc with apache/ngnix, You must upload your static and public files inside a specific folder or else the fatal server files will be visible, especially if they contain sensitive data. Since we only want static files to be accessible, you can use the code I’ve provided above.