htaccess的从HTML到PHP重定向所有,但一个页面 [英] htaccess redirect all but one page from html to php

查看:220
本文介绍了htaccess的从HTML到PHP重定向所有,但一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站设置了htaccess的指挥从HTML所有网页到PHP如下:

My site is set up with htaccess directing all pages from html to php as below:

RewriteEngine On
RewriteBase /

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

RewriteRule ^(.+)\.html$ http://www.website.com/$1.php [R=301,L]

我想成立雅虎网站浏览器,并验证我的账户,我需要以添加元标记或HTML文件添加到我的网站的根文件夹。雅虎拒绝承认我的元标签(我确信我已经正确地添加它)!所以,我唯一的选择是添加HTML文件。

I am trying to set up Yahoo Site Explorer and to verify my account I need to either add a meta tag or add a html file to my website root folder. Yahoo is refusing to recognize my meta tag (I am sure I have added it correctly)! So my only option is to add the html file.

我的HTML文件不断得到重定向到PHP,似乎雅虎找不到了。

My html file keeps getting redirected to php and it seems yahoo cannot find it.

有什么我可以添加到我的htaccess文件,使所有的文件被重定向到从一个文件雅虎需要看到除了PHP的?

Is there something I can add to my htaccess file so that all files are redirected to php apart from the one file yahoo needs to see?

推荐答案

尝试添加这样的条件:

RewriteCond %{REQUEST_FILENAME} !-f

这应该允许实际存在(还有其他可供选择的其他类型的文件)的文件。这是假设它不会搞砸任何其他为已经存在的其他文件。

This should allow any files that actually exist (there are other options for other types of files). This assumes it wouldn't mess up anything else for other files that already exist.

这篇关于htaccess的从HTML到PHP重定向所有,但一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆