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 文件夹在本地主机中不可见_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Apache 文件夹在本地主机中不可见

Apache 文件夹在本地主机中不可见,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我下载了一个web模板,当我尝试在本地主机中运行该模板时,该文件夹不会显示。该文件夹包含一个.htaccess文件。当我删除该文件时,我可以看到该文件夹,但当我打开该文件夹时,会出现一些错误 这是.htaccess文件 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^$ index.php [L] RewriteRule ^([a-zA-Z0-9]+)?$ user-profile.php?user

我下载了一个web模板,当我尝试在本地主机中运行该模板时,该文件夹不会显示。该文件夹包含一个.htaccess文件。当我删除该文件时,我可以看到该文件夹,但当我打开该文件夹时,会出现一些错误

这是.htaccess文件

RewriteEngine On   
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteRule ^$ index.php [L]  
RewriteRule ^([a-zA-Z0-9]+)?$ user-profile.php?user_username=$1 [NC,L] 
这是我第一次使用.htaccess文件。。。
非常感谢您的帮助。

看来
RewriteCond
指令的位置不对。。。?我本以为它应该适用于第二条重写规则,而不是第一条:

RewriteEngine On   
RewriteRule ^$ index.php [L]

RewriteCond %{REQUEST_FILENAME} !-f  
RewriteRule ^([a-zA-Z0-9]+)?$ user-profile.php?user_username=$1 [NC,L]

RewriteCond
指令适用于下面的单个
RewriteRule
。第二个规则集基本上说,如果请求的文件不存在,则在内部将请求重写为
用户配置文件.php
页面,将请求(假定为用户名)传递给
用户\ u用户名
参数。

看起来
RewriteCond
指令位于错误的位置。。。?我本以为它应该适用于第二条重写规则,而不是第一条:

RewriteEngine On   
RewriteRule ^$ index.php [L]

RewriteCond %{REQUEST_FILENAME} !-f  
RewriteRule ^([a-zA-Z0-9]+)?$ user-profile.php?user_username=$1 [NC,L]

RewriteCond
指令适用于下面的单个
RewriteRule
。第二个规则集基本上说,如果请求的文件不存在,则在内部将请求重写到
user profile.php
页面,将请求(假定为用户名)传递给
user\u username
参数。

index.php文件php代码中可能有问题?重写规则看起来不错


向我们展示Apache错误日志和重写日志,而不必说什么是错误。

index.php文件php代码中可能存在问题?重写规则看起来不错


向我们展示Apache错误日志和重写日志,而不必说什么是错误。

您的问题是什么?您希望看到目录列表还是什么?如果直接访问文件夹,即
/folder/
,则请求将被路由到
index.php
。因此,您应该看到
index.php
输出的内容。如果你什么都看不到,那很可能就是你的意图。我在localhost索引页面中看不到文件夹…当我尝试使用
localhost/folder/index.php
访问时,它显示了一个内部服务器错误。事实上,“当你删除该文件时”也会出现“一些错误”,这有点令人怀疑。这让我觉得其他东西配置不正确。在网站的其他部分.htaccess/mod_rewrite是否按预期工作?您的问题是什么?您希望看到目录列表还是什么?如果直接访问文件夹,即
/folder/
,则请求将被路由到
index.php
。因此,您应该看到
index.php
输出的内容。如果你什么都看不到,那很可能就是你的意图。我在localhost索引页面中看不到文件夹…当我尝试使用
localhost/folder/index.php
访问时,它显示了一个内部服务器错误。事实上,“当你删除该文件时”也会出现“一些错误”,这有点令人怀疑。这让我觉得其他东西配置不正确。.htaccess/mod_rewrite在站点的其他部分是否按预期工作?尝试交换行..但仍然无法转到index.php当您导航到
/folder/index.php
时会发生什么情况?
index.php
包含什么?当我导航到索引页面时,这就是我现在看到的。。内部服务器错误服务器遇到内部错误或配置错误,无法完成您的请求。index.php包含一个注册用户的简单表单。已尝试交换行..但我仍然无法转到index.php当您导航到
/folder/index.php
时会发生什么情况?
index.php
包含什么?当我导航到索引页面时,这就是我现在看到的。。内部服务器错误服务器遇到内部错误或配置错误,无法完成您的请求。index.php包含注册用户的简单表单。Apache错误日志
[Thu Sep 24 19:38:18.579561 2015][core:alert][pid 2828:tid 1100][client::1:9042]C:/wamp/www/New folder/UserProf/.htaccess:命令“RewriteEngine”无效,可能是服务器配置中未包含的模块拼错或定义了错误
我没有重写日志文件,您必须对该模块进行重写。非常感谢您为meApache启用该模块错误日志
[周四9月24日19:38:18.579561 2015][core:alert][pid 2828:tid 1100][client::1:9042]C:/wamp/www/New folder/UserProf/.htaccess:命令“RewriteEngine”无效,可能拼写错误或由未包含在服务器配置中的模块定义
我没有重写日志文件您必须对该模块进行重写。非常感谢您为我启用该模块