1

I have a number of sites on a "deluxe hosting" plan on GoDaddy, which means there is one top-level site at the root, and for each additional domain, their files reside in a folder within the root. If you think this question has been asked before, then please direct me to the solution, because I can't find quite the answer, though I'm sure it isn't new.

Now, there is an .htaccess file in the root (the top-level site), which is used to redirect in the case where someone types in "index.html" it goes to "index.php":

ErrorDocument 404 /404.php

redirect 301 /about.html /about.php
redirect 301 /boat.html /boat.php
redirect 301 /contact.html /contact.php
redirect 301 /charters.html /index.php
redirect 301 /combotrips.html /index.php
redirect 301 /contact-thanks.html /contact-thanks.php
redirect 301 /crew.html /crew.php
redirect 301 /diving.html /key-west-diving.php
redirect 301 /divingcharters.html /key-west-diving.php
redirect 301 /ecocharters.html /eco-tours.php
redirect 301 /fishingcharters.html /key-west-fishing.php
redirect 301 /gallery.html /gallery.php
redirect 301 /index.html /index.php
redirect 301 /packnship.html /key-west-fish-shipped.php
redirect 301 /testimonials.html /testimonials.php
redirect 301 /thefish.html /key-west-fishing.php
redirect 301 /fishing-charters.php /fishing-charter-rates.php


#redirect 301 /Fish%20Availability%20Chart.pdf /docs/key-west-local-fish.pdf

I did not write the .htaccess file. In fact, I don't really understand .htaccess files all that well.

Now I added a new site, which has its sub-folder. This new site was moved from another completely different hosting company. This new site has an index.html, about.html, etc. When I type in "index.html, it immediately tries to redirect to index.php. Same thing with about.php, and I think all the other .html pages try to redirect to a .php page.

In this new site folder, there is no .htaccess file.

I did write a new .htaccess file, and put a RewriteEngine Off line, but it didn't do anything different.

How can I make this site not redirect the .html files to .php files?

Update: To get this working I gutted all but the first and last lines of the top-level .htaccess file contents. I don't count this as the answer but more like "a solution". I'm not really sure why the top-level site has those redirects to begin with. I inherited this site from a previous web company.

4

1 回答 1

1

首先,您不需要.htaccess文件。.htaccess文件只是用于在用户可控和受限的级别上覆盖服务器的文件httpd.conf,而不允许用户完全控制服务器的配置文件。如果您没有将其用于任何用途,则可以将其删除。

因为在您的浏览器可能缓存它们之前,您的文件中有 301 重定向.htaccess(即使您从.htaccess文件中删除了它们)。

要禁用规则,您可以#在其前面添加注释标签。

此外,您可以删除规则。

在移除重定向规则之前,服务器将发送重定向的标头请求。一旦它被删除(但它在您的缓存中),您将需要删除浏览器的缓存以使重定向停止发生。

不过,您可以保留 .htaccess 文件以重写 40​​4 错误处理程序。

于 2013-06-10T19:52:02.027 回答