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
Php 根文件夹中的索引页和子文件夹中的索引页错误_Php_.htaccess - Fatal编程技术网

Php 根文件夹中的索引页和子文件夹中的索引页错误

Php 根文件夹中的索引页和子文件夹中的索引页错误,php,.htaccess,Php,.htaccess,我有一个带有index.php页面的网站xyz.com,rootfolder中有一个子文件夹。 e、 g.文件夹即。“音频”,其中包含index.php和其他页面 现在的问题是,当我打开www.xyz.com/audio时,它会打开,但当我通过导航菜单在这个音频文件夹中导航,并试图通过单击音频文件夹导航栏中的链接返回到audio/index.php时,它会将我带到www.xyz.com/index.php而不是www.xyz.com/audio/index.php。但音频文件夹中的其他页面导航效

我有一个带有index.php页面的网站xyz.com,rootfolder中有一个子文件夹。 e、 g.文件夹即。“音频”,其中包含index.php和其他页面

现在的问题是,当我打开www.xyz.com/audio时,它会打开,但当我通过导航菜单在这个音频文件夹中导航,并试图通过单击音频文件夹导航栏中的链接返回到audio/index.php时,它会将我带到www.xyz.com/index.php而不是www.xyz.com/audio/index.php。但音频文件夹中的其他页面导航效果很好

我在根文件夹和音频文件夹中使用了.htaccess,并使用了以下规则(用于删除文件扩展名)。是它造成了这个错误吗?还是别的什么?我被绊倒了

RewriteEngine On  

RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} \s/+(?:index)?(.*?)\.(?:php|html)[\s?] [NC]
RewriteRule ^ /%1 [R=301,L,NE]

RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} /index [NC]
RewriteRule ^(.*?)index([/.]|$) /$1 [L,R=302,NC,NE]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteCond %{DOCUMENT_ROOT}/$1.php -f [NC]
RewriteRule ^(.+?)/?$ /$1.php [L]

RewriteCond %{DOCUMENT_ROOT}/$1.html -f [NC]
RewriteRule ^(.+?)/?$ /$1.html [L]

音频文件夹导航栏中的链接具体指向什么?您能否注释掉第二条
R=302
规则并重新测试。同时发布您的
/audio/.htaccess
文件。音频文件夹中的htaccess与above@anubhava,音频文件夹中的.htaccess与上述相同。您是否按照我的建议注释掉了.htaccess中的第二条
R=302
规则并重新测试了?