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
Debug.htaccess语法错误_.htaccess_Mod Rewrite_Syntax_Server - Fatal编程技术网

Debug.htaccess语法错误

Debug.htaccess语法错误,.htaccess,mod-rewrite,syntax,server,.htaccess,Mod Rewrite,Syntax,Server,我有以下代码: # Rewrite to www Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^salom.dev[nc] RewriteRule ^(.*)$ http://www.salom.dev/$1 [r=301,nc] # 301 Redirect Entire Directory RedirectMatch 301 /admin(.*) /vendor/aheinze/cockpit/$1

我有以下代码:

# Rewrite to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^salom.dev[nc]
RewriteRule ^(.*)$ http://www.salom.dev/$1 [r=301,nc]

# 301 Redirect Entire Directory
RedirectMatch 301 /admin(.*) /vendor/aheinze/cockpit/$1

# Change default directory page
DirectoryIndex /site

# Prevent viewing of .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>

# Prevent directory listings
Options All -Indexes
#重写到www
选项+FollowSymLinks
重新启动发动机
RewriteCond%{HTTP_HOST}^salom.dev[nc]
重写规则^(.*)$http://www.salom.dev/$1[r=301,北卡罗来纳州]
#301重定向整个目录
重定向匹配301/管理员(.*)/供应商/aheinze/驾驶舱/$1
#更改默认目录页
目录索引/网站
#阻止查看.htaccess文件
命令允许,拒绝
全盘否定
#阻止目录列表
选项所有-索引
我不断地犯500个错误,但我找不到问题,有什么想法吗

以下是conf文件:

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName salom.dev

        DocumentRoot /home/otis/Developer/salom
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /home/otis/Developer/salom/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

服务器管理员webmaster@localhost
服务器名salom.dev
DocumentRoot/home/otis/Developer/salom
选项如下符号链接
允许超越所有
选项索引跟随符号链接多视图
允许超越所有
命令允许,拒绝
通融

还有一种方法可以使用开发工具或日志调试这些错误吗?

DirectoryIndex
是一个文件而不是目录,在“[nc]前面缺少一个空格

试试这个。htaccess:

# Change default directory page
# DirectoryIndex /site

# Rewrite to www
Options +FollowSymLinks -Indexes
RewriteEngine on

RewriteCond %{HTTP_HOST} ^salom\.dev$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

# 301 Redirect Entire Directory
RewriteRule ^admin(.*) /vendor/aheinze/cockpit/$1 [L,NC,R=301]

# Prevent viewing of .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
#更改默认目录页
#目录索引/网站
#重写到www
选项+FollowSymLinks-索引
重新启动发动机
RewriteCond%{HTTP_HOST}^salom\.dev$[NC]
重写规则^(.*)$http://www.%{HTTP_HOST}/$1[R=301,L]
#301重定向整个目录
重写规则^admin(.*)/供应商/aheinze/CACKPOD/$1[L,NC,R=301]
#阻止查看.htaccess文件
命令允许,拒绝
全盘否定

仍在发生,它将我带到
salom.dev/site/
,这是需要的,但仍然抛出500个错误。请检查您的Apache error.log以了解确切的错误,并尝试清除浏览器缓存。已启用mod_rewrite,但现在它说服务器上不存在
/site/
,它确实存在。
site
目录是否存在于下
/home/otis/Developer/salom
?还有,当我注释掉
DirectoryIndex
行时,路由到
site/
的规则是什么?很抱歉,这与www前缀有关