久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 RewriteRule 后不加載樣式表并包含

Stylesheet does not load after using RewriteRule and include(使用 RewriteRule 后不加載樣式表并包含)
本文介紹了使用 RewriteRule 后不加載樣式表并包含的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個網站,它有一個 index.php、幾個簡單的 .html 頁面和一個 .php 頁面(聯系表格)以及一個 .htaccess 文件.在我的網站上,我有指向頁面的按鈕,如下所示:index.php?p=welcome.php(示例).如您所見,index.php 文件 includes 一個頁面,具體取決于 GET 傳遞的內容.

I have a website that has an index.php, a few simple .html pages and one .php page (contact form) as well as a .htaccess file. On my website I have buttons that point to the pages as follows: index.php?p=welcome.php (example). As you can see, the index.php file includes a page, depending on what was passed on by GET.

我寫了 .htaccess 來顯示:http://www.site.com/welcome/ 而不是 http://www.sites.com/index.php?p=歡迎.鏈接和重寫都有效.我遇到的唯一問題是當我單擊其中一個按鈕導航到另一個頁面時:沒有任何樣式.

I've written the .htaccess to show: http://www.site.com/welcome/ instead of http://www.sites.com/index.php?p=welcome. The links and rewrite both work. The only problem I have is when I click one of the buttons to navigate to another page: there is no styling whatsoever.

我已經測試過 index.php 文件是否正確地包含了其他頁面,并且確實如此.只是樣式表似乎不起作用.style.css 包含在它所屬的 index.php 文件的頂部.以下是我想向您展示的一些代碼:

I've tested to see if the index.php file is including the other pages properly, and it does. It's just the stylesheet that doesn't seem to work. The style.css is included at the top of the index.php file, where it belongs. Here are bits of code I'd like to show you:

按鈕

<table>
    <tr>
        <td><a href="/welcome/"><div>Welcome</div></a></td>
    </tr>
    <tr>
        <td><a href="/references/"><div>References</div></td></a>
    </tr>
    <tr>
        <td><a href="/aboutme/"><div>About me</div></td></a>
    </tr>
    <tr>
        <td><a href="/contact/"><div>Contact</div></td></a>
    </tr>
</table>

.htaccess

RewriteEngine On
RewriteRule ^([a-z]+)/$ index.php?p=$1

需要說明的是:該站點仍然像往常一樣運行,但它只是不應用樣式表中的任何樣式.任何幫助將不勝感激.

To make it clear: the site still functions as it normally does, but it just does not apply any styling from the stylesheet. Any help would be much appreciated.

推薦答案

如果使用相對路徑包含樣式表,那么這就是問題所在.嘗試使用:/path/to/style.css 而不是 relative/path/to/style.css

If the stylesheet is being included using a relative path, then that would be the problem. Try using: /path/to/style.css rather than relative/path/to/style.css

因此,如果您的樣式表位于 templates/style.css 中并且您如此引用它,那么當您重寫 URL http://www.site.com/index.php 時?page=welcomehttp://www.site.com/welcome/,樣式表的路徑是相對的:

So if your stylesheet lives in templates/style.css and you reference it as such, when you rewrite the URL http://www.site.com/index.php?page=welcome to http://www.site.com/welcome/, the stylesheet's path is relative to that:

http://www.site.com/welcome/templates/style.css

這篇關于使用 RewriteRule 后不加載樣式表并包含的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Action View Helper in Zend - Work around?(Zend 中的動作視圖助手 - 解決方法?)
Is this a good way to match URI to class/method in PHP for MVC(這是將 URI 與 PHP 中用于 MVC 的類/方法匹配的好方法嗎)
Where do I save partial (views) in Zend Framework, to be accessible for all Views in my App?(我在哪里保存 Zend Framework 中的部分(視圖),以便我的應用程序中的所有視圖都可以訪問?) - IT屋-程序員軟件開發技術
Having a single entry point to a website. Bad? Good? Non-issue?(有一個網站的單一入口點.壞的?好的?沒問題?)
Is MVC + Service Layer common in zend or PHP?(MVC + 服務層在 Zend 或 PHP 中常見嗎?)
Hello World example in MVC approach to PHP(PHP MVC 方法中的 Hello World 示例)
主站蜘蛛池模板: 国产精品亚洲精品日韩已方 | 男女羞羞视频网站 | 欧美日韩淫片 | 伊人久久免费 | 综合第一页| 日韩一区二区av | 欧美午夜精品 | 麻豆av一区二区三区久久 | 一区二区三区视频在线观看 | 国产综合网站 | 亚洲精品二区 | 成人在线免费观看视频 | 国产综合久久久 | 日韩精品一区二区三区高清免费 | 在线91 | 欧美精品二区 | 欧美a在线观看 | 黄在线免费观看 | 日韩欧美国产精品一区 | 国产精品18hdxxxⅹ在线 | 免费视频二区 | 综合九九 | 天天天操 | av在线一区二区 | 91看片在线 | 免费看片在线播放 | 欧美精品在线免费观看 | 91精品国产91久久久久久吃药 | 日韩欧美视频在线 | 国产999精品久久久影片官网 | 国产精品女人久久久 | 免费日本视频 | 欧美激情国产精品 | 九九九久久国产免费 | 成人在线免费av | 成人激情视频免费观看 | 国产成人精品网站 | 看a网站| 精品免费国产 | 日本成人久久 | 欧美亚洲综合久久 |