【发布时间】:2019-01-18 22:28:33
【问题描述】:
我正在开发一个网站并试图获得:
http://localhost/dir1/dir2/index.html#home
变成:
http://localhost/index.html#home
试过了:
RewriteEngine On
RewriteRule ^/?$ /dir1/dir2/
但运气不好,它重定向到http://localhost/dir1/!
我的index.html 文件位于/var/www/html/dir1/dir2 文件夹下,正如您想象的从URL 中看到的那样。
有什么帮助吗?
谢谢
我正在开发一个网站并试图获得:
http://localhost/dir1/dir2/index.html#home
变成:
http://localhost/index.html#home
试过了:
RewriteEngine On
RewriteRule ^/?$ /dir1/dir2/
但运气不好,它重定向到http://localhost/dir1/!
我的 index.html 文件位于 /var/www/html/dir1/dir2 文件夹下,正如您想象的从 URL 中看到的那样。
有什么帮助吗?
谢谢
*编辑**:
.htaccess 放置在根文件夹中,因此在dir1 的父级中。
【问题讨论】: