Htaccess redirects all but one page from html to php

My site is configured with htaccess directing all pages from html to php, as shown 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]

I'm trying to set up Yahoo Site Explorer and check my account, I need to either add a meta tag or add an html file to the root folder of your site. Yahoo refuses to recognize my meta tag (I'm sure I added it correctly)! So my only option is to add the html file.

My html file continues to be redirected to php and it seems that yahoo cannot find it.

Is there something I can add to my htaccess file so that all files are redirected to php separately from the single file that yahoo should see?

+4
source share
2 answers

:

RewriteCond %{REQUEST_FILENAME} !-f

, ( ). , , .

+7

( , - ):

1. , :

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

# do not do any rewriting to this file
RewriteRule somefile\.html$ - [L]

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

, ( , , - URL- NO lead slash ):

# do not do any rewriting to this file
RewriteRule ^full/path/to/somefile\.html$ - [L]

2. , :

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

# do not do anything for already existing files
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .+ - [L]

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

3. , .html .php:

RewriteCond %{REQUEST_URI} !somefile\.html$
RewriteRule ^(.+)\.html$ http://www.website.com/$1.php [R=301,L]

, , ( , , - URL- )

RewriteCond %{REQUEST_URI} !^/full/url/path/to/somefile\.html$

4. , .html .php, .html :

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)\.html$ http://www.website.com/$1.php [R=301,L]

, .htaccess . .

+4
source

All Articles