English 中文(简体)
URL 沉积后丢失的CSS文档和图像
原标题:Missing CSS file and images after URL rewrite

I m trying to make user friendly URL using mode rewrite. My problem is, that after giving category like name to my URL, when I call the page using new URL, it can t load the CSS file or images.

我有这样的联系:

当地东道/米网站/项目?id=22

新的联系就象这样的。

当地东道/米网站/项目22/米项目。

htaccess Code:

RewriteRule ^project/([0-9]*)/.*.project$ /project.php?project=$1 [L]

(这也许不是100%的权利,但现在我没有接触过我的法典,所以我只是作此写,在原始来源上做罚款)

我的根基名录是当地的东道主/我的网站/

和我的特别安全局档案都存放在箱子/式箱子里。

localhost/mywebsite/css/style.css

我的通道

Localhost/mywebsite/htaccess

和我的项目。 php档案中

Localhost/mywebsite/project.php

因此,在项目网页上,我可以通过使用相对途径查阅安保科档案。

<link href="css/style.css" rel="stylesheet" type="text/css" />

但是,当我使用改写的URL页面时,可以发现CSS的档案。

我不能用域名来绝对走,因为我没有领域! 并且可能是任何东西。

one way is to use relative path to domain as suggested on the similar questions Localhost/mywebsite/project.php and when i run my script localy my root directory is localhost so css link should look like

href=“mywebsite/cs/type.cs”

but when i go live i should change all links to probably something like

href=”/cs/type.cs

这似乎与许多工作一样。

最佳回答

页: 1

<base href="//localhost/mywebsite" />

页: 1

以及您的生活版本

<base href="//your.domain.here" />

http://www.w3.org/TR/html4/struct/links.html#h-12.4>。

问题回答

你们必须界定相关方面的基本道路或服务器观点。 php,凡想走这条道路的,都使这个全球成为可能。 这样,变数就会被点燃, c或图像将走整个道路。

for example $SVP="http://www.example.com/"

global $SVP; echo $SVP;

......

在同一个档案中插入一个形象,其途径与圆顶连接,在浏览器上装上该页,在互联网探索器上打上正确的图像,点击特性,以及你应当看到相对路径实际上在哪里。





相关问题
URL rewrite in IIS6 - Third party tools

I have collected the following api/sdk/whatever which provide modules for doing url rewriting in IIS 5/6/7. Some are free-open source and some require $. I haven t tried any of them. I would like to ...

Rewrite spring-security redirect URLs

I m trying to get Tuckey UrlRewriteFilter to tidy up URLs for my webapp. One problem I ve got is that when spring-security notices that an anonymous user is trying to access a protected resource it ...

ASP.NET Friendly URLs

In my research, I found 2 ways to do them. Both required modifications to the Application_BeginRequest procedure in the Global.Asax, where you would run your code to do the actual URL mapping (mine ...

Could I get by HttpModule the URL that contains * before?

My web-site is working under ASP.NET 3.5, IIS7, Integrated pipiline mode. My HttpModule is getting request to all resources, including URLs like this: http://my-site.com/address And I would support *...

Domains & Foreward Slash

This is rather difficult to explain so please bear with me. We will be hosting 4 websites on our server and the plan is to have each site sit under its own domain: site-a.com site-b.com sub1.site-b....

URL Mod-Rewrite

I currently have a working URL: http://example.com/security-services.php?service=fixed-camera-surveillance and then I have PHP say, $_REQUEST[ service ] to do some stuff... But I d like to ...

热门标签