I am trying to redirect all requests to a subdirectory and any files in it to the root directory using htaccess. I currently have redirect 301 / directory // But this is redirected to the root with the file name that was added to it .. ie www.domain.com/directory/this.html redirects to www.domain.com/this. html I don’t want it to request a file at all. Is there any way to do this?
thank
Charles
You may have to use mod_rewrite. Assuming you put .htaccess in the root directory, something like this should work.
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^name-of-subfolder/.*$ / [R=302] </IfModule>
NB. 302, , 301 . , 302.
Source: https://habr.com/ru/post/1757019/More articles:How to change default WCF page returned in browser? - wcfSwing: steal focus from other applications (usability in OS X) - javaHow can I change the html output of a wcf service with my own content? - htmldate appears the day before what is programmed in JasperServer - javaЯвляется ли хорошей практикой возвращать IEnumerable для коллекции, которая реализует INotifyCollectionChanged - c#RTL (справа налево) навигация по клавиатуре в HTML - right-to-left Jquery, activate the script if hashtag at the end of the URL matches the class name - jquery Нужна помощь в понимании того, как List