【发布时间】:2021-03-10 02:56:56
【问题描述】:
好的,所以我已经尝试查找此答案,并在 discord 上与 ppl 进行了交谈,但似乎没有答案,所以这可能是我的最后一站。
这是我的文件结构
> index.html
> x (FOLDER)
> i_am_in_x.html
> xD.html
> y (FOLDER)
> not.html
> yes.html
> somefile.html
> x.html
> y.html
> styles (FOLDER)
> images (FOLDER)
目标是:删除页面末尾的“.html”扩展名。
例子:
example.com/x 而不是 example.com/x.html;
example.com/y/not 而不是 example.com/y/not.html**
关于如何实现这一点的任何想法?
我使用了几个不同的代码。我目前正在使用的那个:(.htaccess)
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ %{REQUEST_FILENAME}.html
【问题讨论】:
-
请在您现在使用的问题中添加您的 htaccess 文件,谢谢。
-
我曾经用过几个不同的。我在问题中添加了我现在正在使用的那个。