问题描述
我尝试了多种不同的代码,但它给了我相同的结果(不是我想要的): 这是我使用的一个代码:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [NC,L]
我想做什么: 我正在尝试删除页面 url 上的 .html 扩展名:(example.com/page 而不是 example.com/page.html)。
在 html 方面我有
index.html
<a href = 'page'> go to page </a>
以下是page.html的内容
page.html
<h1> Welcome to this page. </h1>
<p> Yesturday Stackoverflow paid everyone's dept... bla bla text. balbla. </p>
<a href = "more.html"> read more </a>
<a href = "contact.html"> contact us </a>
当我点击 index.html 上的“转到页面”链接时,它会转到 example.com/page。并且页面只显示带有大字体的“页面索引”,以及“页面”页面上更多文件的链接列表(阅读更多,联系)。它们显示在表格中,它让我可以选择按名称、大小或上次修改进行排序。 文件结构:
> index.html
> page.html
> .htaccess
> _folder
> abcd.html
那么,这里可能有什么问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)