如何访问相同的目录文件.htaccess


how to access same directory file in .htaccess

我面临的问题是当 url是 http://localhost/admin/add_department/11然后我点击了一个按钮,在同一文件夹下,将去general_setting.php但是 url将成为 http://localhost/admin/add_department/general_setting仍然在add_department页
我想让它变成 http://localhost/admin/general_setting
这是我当前的文件内容

RewriteEngine On
RewriteBase /
RewriteRule ^(admin)/(['w-]+)/(['w-]+)/?$ test/application/$1/$2.php?action=edit&department_id=$3 [L,QSA,NC]
RewriteRule ^(admin)/(['w-]+) test/application/$1/$2.php [L,QSA,NC]

http://localhost/admin/general_setting是我当前下的工作。
如何将http://localhost/admin/add_department/11重定向到http://localhost/admin/general_setting
谢谢~

只有服务器知道你的文件夹结构。所以,如果你想从http://localhost/admin/add_department/11转到http://localhost/admin/general_setting,你应该让你的链接指向../general_setting,而不仅仅是'general_setting'。

第二个选项是使所有url相对于域。如果你想去http://localhost/admin/add_department/11。你把链接设为/admin/add_department/11,如果你想去http://localhost/admin/general_setting,你把链接设为/admin/general_setting。开头的斜杠表示它必须从您所在的域查找。

你可能需要根据你的情况设置一个基本标签。

<base href="http://localhost">

基标签文档