本文介绍了样式表和隐藏的.html扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对网站内容并不感到惊讶,但是我有一个正在重新设计的小型投资组合网站。我想隐藏 example.com/page.html 并将其设置为website.com/page。

I'm not amazing with web stuff but I have a small portfolio site which I am redesigning. I am looking to hide the example.com/page.html and make it website.com/page.

我在这里为.htaccess添加了重写引擎。

I added the rewrite engine which I found on here for the .htaccess

RewriteEngine On
RewriteRule   ^([A-Za-z0-9-]+)/?$  $1.html

唯一的问题是我使用 RewriteEngine /page.html 的原始路径正常加载,但是当我将其测试为 / page / 似乎丢失了样式表,我尝试将样式表重新链接为 ... / style.css 而不只是 style.css ,但似乎所有图像和样式表都丢失了。

The only problem is that when I use the RewriteEngine, the original path of /page.html loads as normal, but when i test it as /page/ it seems to lose the style sheet, I've tried relinking the style sheet as .../style.css instead of just style.css, but still all the images and style sheet seem to go missing.

也许这很简单,但是我在这里需要帮助。

It's probably something pretty damn simple but I need some help here.

推荐答案

我从您的话中了解到,您想您的网址,例如:

好 。如果您不必使用htaccess,则可以执行此操作来完成所需的操作。
只需将文件名(page.html)更改为(index.html)即可。现在在您的根目录中创建一个新文件夹,并将index.html移到那里!
,如果文件(page.html)是您的主页,只需将其名称更改为index.html,就不用管它了:D!

what i understood from your words is that you want to make your url like :http://www.example.com/pageok . if you don't have to use htaccess , you can do this to do what you want .just change the file name (page.html) to (index.html) . now create a new folder in your root and move the index.html to there !and if the file , (page.html) is your home page , just change its name into index.html and leave it alone :D !

这篇关于样式表和隐藏的.html扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 02:44