我可以将 index.php 放在子目录中,但不能在 url 中显示子目录吗?

moo*_*dog 3 php .htaccess

我有一个网站,比如http://mysite.com。我想把 index.php 放在一个子目录中, public_html/mysubdir/index.php. 我想public_html/mysubdir/index.php在用户访问http://mysite.com时被执行。我希望网址继续阅读http://mysite.com。这可能吗?

Ale*_*lex 5

如果您的网络服务器是 Apache,您可以使用带有 mod_rewrite 的 URL 重写

另一种选择是在根目录中创建一个 index.php 并在子目录中包含 index.php。