Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache .htaccess文件夹到虚拟文件夹重写_Apache_.htaccess_Mod Rewrite_Url Rewriting - Fatal编程技术网

Apache .htaccess文件夹到虚拟文件夹重写

Apache .htaccess文件夹到虚拟文件夹重写,apache,.htaccess,mod-rewrite,url-rewriting,Apache,.htaccess,Mod Rewrite,Url Rewriting,Apache的重写引擎是否可以执行以下操作,以及如何执行 这就是环境: domain.com有一个包含index.html页面的文件夹,htaccess设置为剥离文件,因此domain.com/folder/打开domain.com/folder/index.html 现在我需要实现的是显示domain.com/folder/内容(index.html),因为它来自domain.com/virtualfolder/,其中virtualfolder不存在,url必须显示为domain.com/vi

Apache的重写引擎是否可以执行以下操作,以及如何执行

这就是环境:

domain.com有一个包含index.html页面的文件夹,htaccess设置为剥离文件,因此domain.com/folder/打开domain.com/folder/index.html

现在我需要实现的是显示domain.com/folder/内容(index.html),因为它来自domain.com/virtualfolder/,其中virtualfolder不存在,url必须显示为domain.com/virtualfolder/

我希望我写的是可以理解的

非常感谢

您需要一个别名:

Alias /virtualfolder /full_path_to/domain.com/folder
有关更多详细信息,请参阅。


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^virtual-folder/(.*)$ folder/$1 [QSA]
</IfModule>
重新启动发动机 重写规则^virtual folder/(.*)$folder/$1[QSA]
别名是最方便的方式,但需要将别名放在httpd.conf中。如果您租用一些web空间,提供商通常只允许您编辑.htaccess文件,并且不可能在其中放置别名。在这种情况下,您需要使用mod_rewrite。只是现在打字时有同样的问题

然而,如果你租用了一些web空间,并且安装了Plesk 11.5或12.0,通常会有一个选项“虚拟目录”(如果没有停用)