Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.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
Mod rewrite 如何用mod_rewrite模拟public dir_Mod Rewrite_Public Html - Fatal编程技术网

Mod rewrite 如何用mod_rewrite模拟public dir

Mod rewrite 如何用mod_rewrite模拟public dir,mod-rewrite,public-html,Mod Rewrite,Public Html,我将我的网站文件保存在/public/目录中 例如,要访问css文件,如果我们指向绝对html路径,它将是 /public/css/reset.css 我有/public/index.php文件来处理每个请求。所以,我的主站点API运行良好 以下是我的简单.htaccess:(在publicdir之外) 重新启动发动机 重写规则!\。(js | ico | gif | jpg | png | css | html)$public/index.php 如何添加mod_重写规则,因此,当我询问m

我将我的网站文件保存在
/public/
目录中

例如,要访问css文件,如果我们指向绝对html路径,它将是

/public/css/reset.css

我有
/public/index.php
文件来处理每个请求。所以,我的主站点API运行良好

以下是我的简单.htaccess:(在
public
dir之外)


重新启动发动机
重写规则!\。(js | ico | gif | jpg | png | css | html)$public/index.php

如何添加mod_重写规则,因此,当我询问
mysite.com/css/reset.css
时,我得到了
mysite.com/public/css/reset.css
(对于其他文件也是如此)

我已经尝试过了。它不起作用;(当我打开
mysite.com
时,它会打开我网站的目录,只有当我指向
http://mysite.com/public/$1
而不是
public/$1
,无需重写即可工作。并且可以不直接重定向?我的意思是不在url中显示/public/path?
<IfModule mod_rewrite.c>
RewriteEngine On 
RewriteRule !\.(js|ico|gif|jpg|png|css|html)$ public/index.php
</IfModule>
RewriteCond -f public%{REQUEST_URI}
RewriteRule ^(.+)$ public/$1 [L]