.htaccess 如何在htaccess中设置base dir

.htaccess 如何在htaccess中设置base dir,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我有我的网站的结构 我的网站 index.php index_admin.php 通过重写.htaccess www.mywebsite.com/home/main --converts--> mywebsite/index.php www.mywebsite.com/home/admin --converts--> mywebsite/index_admin.php 这正在工作(托管) 现在,我尝试使用XAMPP Linux在localhost上运行,以供开发之用 网址

我有我的网站的结构

  • 我的网站
    • index.php
    • index_admin.php
通过重写.htaccess

www.mywebsite.com/home/main --converts--> mywebsite/index.php
www.mywebsite.com/home/admin --converts--> mywebsite/index_admin.php
这正在工作(托管)

现在,我尝试使用XAMPP Linux在localhost上运行,以供开发之用 网址


localhost/mywebsite/index.php
已启动,但当登录并导航到url
/home/admin
时,它会变成未找到的
localhost/home/admin
。我希望它成为
/localhost/mywebsite/home/admin
,以便正确导航到
index_admin.php
文件,您可能希望与路由器一起查看。然后,您只需要配置web服务器,将所有请求重定向到index.php中的不存在的文件/文件夹,并处理应用程序中的所有路由。它还使将应用程序迁移到另一个web服务器(如不读取htaccess的nginx)变得更加容易。您能展示您的完整.htaccess吗