1

我只是想问一下,如何使用 htaccess 将 html 后缀添加到我网站的每个 url?

像这样的网址:

www.mysite.com/index.php?hello/world

应该成为

www.mysite.com/index.php?hello/world.html

4

2 回答 2

2
  RewriteEngine On

  RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]

  RewriteRule ^(.*)$ http://www.mydomain.com/$1\.html [R=301,L] 
于 2009-11-13T06:07:50.180 回答
1

另一种方法是打开MultiViews。只需将以下行添加到.htaccess目录(或 httpd.conf)中的文件中。请注意,Options All不要打开 MultiViews,您需要明确打开它。

Options +MultiViews

有关它的作用的更多信息,请参见http://httpd.apache.org/docs/2.0/en/content-negotiation.html中的 MultiViews 部分和http://httpd.apache.org/docs/2.0/en/ mod/core.html#options有关选项的更多信息。

于 2012-03-20T19:30:30.733 回答