Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.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

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将两个html文件重写为两个php文件_Apache_.htaccess_Mod Rewrite_Redirect - Fatal编程技术网

Apache htaccess将两个html文件重写为两个php文件

Apache htaccess将两个html文件重写为两个php文件,apache,.htaccess,mod-rewrite,redirect,Apache,.htaccess,Mod Rewrite,Redirect,在我正在构建的网站上,我需要将index.html重定向到index.php 我通过以下方式实现了这一目标: RewriteEngine On RewriteBase / RewriteRule ^index\.html?$ / [NC,R,L] 在.htaccess中,它可以完美地工作。我现在需要再添加一个文件重定向到子目录中的一个文件:membership/been-a-member.html-我尝试使用新的重写规则添加这个文件,并将其添加到现有规则中,但无法将其重定向到membershi

在我正在构建的网站上,我需要将index.html重定向到index.php

我通过以下方式实现了这一目标:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.html?$ / [NC,R,L]
在.htaccess中,它可以完美地工作。我现在需要再添加一个文件重定向到子目录中的一个文件:membership/been-a-member.html-我尝试使用新的重写规则添加这个文件,并将其添加到现有规则中,但无法将其重定向到membership/been-a-member.php-非常感谢您的帮助

谢谢


`

您可以使用新规则将.php添加到2个路径:

RewriteEngine On
RewriteBase /

RewriteRule ^index\.html?$ / [NC,R,L]

RewriteRule ^(become-a-member|another)\.html?$ $1.php [NC,L]