PHP的包括和不工作的重写URL的图像 [英] Php includes and images not working for Rewritten urls

查看:127
本文介绍了PHP的包括和不工作的重写URL的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编辑htaccess文件的短网址,现在我的页面已经打破,PHP包括文件和图像无法正常工作,

After editing htaccess file for the short urls ,now my page has broken and php included files and images are not working,

这是我的htaccess中的public_html

This is my htaccess in the public_html

 RewriteRule ^car/name/(.*)$ /car.php?name=$1 [L,QSA] 

包含的所有文件和图像在 /文件文件夹,

现在的问题是,当我访问

Now the problem is when I visit

http://example.com/car.php?name=hundai 

它的工作原理,并一切正常,

it works and everything is ok,

但问题是重写的URL

but the problem is with Rewritten url

http://example.com/car/name/hundai 

它打破了所有的PHP文件和图像。
能否请你帮定为这?

It breaks all php files and images.
Can you please help a fix for this?

推荐答案

重写规则正在改变您的网址 HTTP :?//example.com/car.php名= hundai 的http://例子。 COM /汽车/名称/ hundai 的,这意味着文件的路径是目录它不是之前内部。这意味着,在文档中的任何相对链接将无法正常工作。为了解决这个问题,您需要使用HTML

RewriteRule is changing your URL http://example.com/car.php?name=hundai into http://example.com/car/name/hundai ,which means that files path is inside a directory it was not before. this means that any relative links in document will not work. To solve this You need to use an Html

基地  标签内部文档的头。

Base tag inside the "head" of your document.

 <head>
 <base href="http://example.com/files/">
 </head>

这篇关于PHP的包括和不工作的重写URL的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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