Simply I just want to hide my existing folder name, And access that folder and files with a custom name.
For example,
I have a folder named old_folder, and now I can access it with https://example.com/old_folder
But I want to block this URL. If someone browses this, The page should show an error message or custom page, if possible.
The folder and files inside the old folder should access with a custom name. Like https://example.com/custom_folder. If there will exist any file, https://example.com/custom_folder/file1.jpg
I tried,
RewriteCond %{THE_REQUEST} \s/+old_folder(/\S*)?\s [NC]
RewriteRule ^ /custom_folder%1 [R=301,L,NE]
RewriteRule ^custom_folder(/.*)?$ old_folder$1 [L,NC]
It helps me to access custom_folder URL.
But still, if I use old_folder in the URL, it didn't block.