Php includes and images not working for rewritten urls
After editing the htaccess file for short urls, now my page broke and php included files and images don't work,
This is my htaccess in public_html
RewriteRule ^car/name/(.*)$ /car.php?name=$1 [L,QSA]
All included files and images are in the / files folder ,
Now the problem is that I am visiting
http://example.com/car.php?name=hundai
it works and everything is fine,
but the problem is that the Rewritten url
http://example.com/car/name/hundai
It splits all php files and images.
Can you help fix this?
+3
source to share
1 answer
The RewriteRule changes your url http://example.com/car.php?name=hundai to http://example.com/car/name/hundai , which means the file path is inside a directory that wasn't there before. this means that any relative links in the document will not work. To solve this problem you need to use Html
Base tag inside the "chapter" of your document.
<head>
<base href="http://example.com/files/">
</head>
0
source to share