如何将 HTACCESS 更改重定向到现在允许子目录 URL?

How to redirect HTACCESS changes to now allow subdirectory URL?

我成功地更改了我的 .htaccess 文件,将 url 更改为我的网站文件,删除了 access 文件夹。
网站地图

index.php
/access
    -dashboard.php
    -posts.php
    -account.php

旧URL:mywebsite.com/access/dashboard.php
新 URL: mywebsite.com/dashboard.php
这一切都运行良好,唯一的问题是,我仍然可以从旧 url 访问我的文件。我想将 url 重定向到新的,这样它就不再被使用了。我怎样才能做到这一点?
这是我当前的 .htaccess 文件:

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/access/.php -f
RewriteRule ^(.+?)/?$ access/.php [L,NC]

RewriteBase / 行下方插入此规则:

RewriteCond %{THE_REQUEST} \s/+access/(\S*) [NC]
RewriteRule ^ /%1 [R=301,L,NE]

这将匹配来自 原始 Apache 请求/access/<anything> 并重定向到没有 /access.

的 URL