Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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 - Fatal编程技术网

Apache .htaccess重写高级规则

Apache .htaccess重写高级规则,apache,.htaccess,Apache,.htaccess,我想要一个.htaccess重写规则,但我想不出怎么做 例子 www.example.com/index.php=>www.example.com/index.php www.example.com/folder/profile.php=>www.example.com/profile.php www.example.com/folder=>www.example.com 一种重写规则,可以在顶层为特定文件夹中的文件提供服务,同时仍为顶层文件提供服务。给你!试试这个 编辑:对exclude in

我想要一个.htaccess重写规则,但我想不出怎么做

例子

www.example.com/index.php=>www.example.com/index.php

www.example.com/folder/profile.php=>www.example.com/profile.php

www.example.com/folder=>www.example.com

一种重写规则,可以在顶层为特定文件夹中的文件提供服务,同时仍为顶层文件提供服务。

给你!试试这个

编辑:对exclude index.php进行了更改

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/folder/
RewriteRule ^(.*)$ folder/$1 [L]

我对我的Zend Framework项目也这样做,我将所有请求从我的路由到

以重定向,如果文件不存在,请执行此操作

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /folder/$1 [R]

是否要在此处生成example.com/index.php am异常?很抱歉,虽然我看到了你的问题,但我认为你的答案有错::PI做了更改,你现在可以试试吗?你是否包含了一个标志,我建议从[R]开始