从纯 html 页面创建漂亮的 url?

The*_*Guy 0 .htaccess friendly-url clean-urls pretty-urls

我已经查看了几篇关于设置“漂亮 URL”的文章,但我似乎无法找到任何对我有用的东西。我是整个 .htaccess 过程的新手,似乎我所看到的一切都是面向动态的、基于 .PHP 的站点。这是我希望看到的:

丑网址:http : //www.example.com/test.html
漂亮网址:http : //www.example.com/test/

它目前在 .htaccess 文件中尝试使用的是:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([a-z]+)$ $1.html
Run Code Online (Sandbox Code Playgroud)

到目前为止,我没有运气。我没有在页面上使用任何形式的 .php - 这些是静态的 .html 页面。任何帮助将不胜感激。谢谢!

The*_*Guy 6

没关系。我想通了是什么问题。我的编译器损坏了 .htaccess 文件,它在加载时触发了站点范围的错误消息。你可以看到它现在在这里工作:

http://www.igeniusstore.com/this-test.html

或者

http://www.igeniusstore.com/this-test

这是我使用的基本代码:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
Run Code Online (Sandbox Code Playgroud)

感谢您所有的帮助。干杯!