是否可以使用 Apache 的 RewriteEngine 执行以下操作以及如何执行?
这是环境:
domain.com有一个文件夹,其中包含index.html页面,htaccess设置为剥离文件,因此domain.com。 com/folder/ 打开 domain.com/folder/index.html
现在我需要实现的是显示 domain.com/folder/ 内容(index.html),因为它来自 domain.com/virtualfolder/ 其中 < strong>virtualfolder 不存在,URL 必须显示为 domain.com/virtualfolder/
我希望我写的内容是可以理解的。
非常感谢
最佳答案
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^virtual-folder/(.*)$ folder/$1 [QSA]
</IfModule>
关于apache - .htaccess文件夹到虚拟文件夹重写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13702680/