1

好的,所以我对 htaccess 非常陌生。基本上,我想要我的网站

http://mydomain.com/game.htmlhttp://mydomain.com/index.php?page=game

我没有当前的 .htaccess,因为我尝试过的几乎所有方法都失败了。有人对此有工作吗?

4

1 回答 1

0

尝试将此添加到文档根目录中的 htaccess 文件中:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)\.html$ /index.php?page=$1 [L,QSA]

/anything.html这在内部重写了对to的请求/index.php?page=anything。您必须确保所有链接看起来像http://mydomain.com/anything.html,因为它不会对浏览器的 URL 地址栏中显示的内容做任何事情。

于 2012-10-28T02:19:34.567 回答