我被 htaccess 卡在这里了。我已经搜索并尝试了许多教程和问题解决方案,但无法实现我想要的。
我想从网站链接中删除文件夹名称。我的 htaccess 文件在根目录中,即“测试”
我的链接是什么样子的:
http://localhost/testing/sub/test.php
我想要的:
http://localhost/test.php
以下是我的htaccess
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule /(.*) /testing/sub/$1 [L]
最佳答案
在你的 root.htaccess 中使用这一行
RewriteRule ^test.php$/testing/sub/test.php
关于php - 使用 htaccess 从 URL 中删除文件夹名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34679002/