Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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文件,使重定向不应用于特定目录。在本例中,目录为“includes/contact” 以下是我的当前htaccess文件: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / ## hide .php extension # To externally redirect /dir/foo.php to /dir/foo RewriteCond %

如何编辑htaccess文件,使重定向不应用于特定目录。在本例中,目录为“includes/contact”

以下是我的当前htaccess文件:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

## hide .php extension
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]

## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]

##NEW SHIT
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

添加一个重写条件,测试请求URI是否以
/includes/contact/
开头,那么,嗯……您是如何做到的?哈哈…我不知道我在做什么?非常感谢您的帮助!一个好的开始是阅读我为您链接的文档…如果我理解该文档,是的,我很可能会得到答案。不幸的是,编码(更不用说Apache)不是我的背景,所以这就是为什么我向比我聪明得多的人提出这个问题。任何帮助都将不胜感激!