htaccess的重写规则不加载网站内容 [英] htaccess rewrite rule not loading site content

查看:153
本文介绍了htaccess的重写规则不加载网站内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我挣扎的.htaccess重写规则。 比方说,我有这个URL。

I am struggling with .htaccess rewrite rules. Let's say I have this URL.

localhost/site/index.php

和我想它改写为这个网址

and I want to rewrite it as this URL

localhost/site/tutorial

我会用这个重写规则

I would use this RewriteRule

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^tutorial/(.*)$ /up/index.php

页面工作,但CSS文件不加载。

The page works, but the CSS files don't load.

另外,如果我有一个网址是这样的:

Also, if I have a URL like this:

index.php?page=home

然后,我将不得不通过URL解析得到'家'不使用$ _GET了正确的?

Then I would have to parse through that URL to get 'home' not using $_GET anymore correct??

推荐答案

只需使用绝对URL为你的CSS文件,或者从域根至少参考。

Just use absolute URLs for your CSS file, or at least reference from domain root.

http://www.mysite.com/css/myCssFile.css

/css/myCssFile.css

这篇关于htaccess的重写规则不加载网站内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆