PHP的包括和不工作的重写URL的图像重写、图像、工作、PHP

由网友(破茧。幻化成蝶)分享简介:在编辑htaccess文件的短网址,现在我的页面已经打破,PHP包括文件和图像无法正常工作,After editing htaccess file for the short urls ,now my page has broken and php included files and images are not...

在编辑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>
阅读全文

相关推荐

最新文章