.htaccess重写会影响html图像源的url

I am trying to redirect a link like www.mywebsite.com/phpfile/uservalue/ to www.mywebsite.com/phpfile.php?param=uservalue

So my .htaccess file is

Options -Indexes
Options +FollowSymLinks  
RewriteEngine On  
RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f  
RewriteRule ^phpfile/(\w*)$ ./phpfile.php?param=$1  

The redirect works well. Now I have a problem. My phpfile.php contains the following html code among other things

<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<img src="logo.png">
</body>
</html>

Now if I enter www.mywebsite.com/phpfile.php?param=uservalue in the browser, the image loads. But if I enter www.mywebsite.com/phpfile/uservalue/ the image does not load.

On inspecting the element, I found that, the php was trying to load http://mywebsite.com/phpfile/logo.png when the image is actually in http://mywebsite.com/logo.png

How do I prevent the extra 'phpfile' folder being added to the image url?

You can solve this using relative url instead of <img src="logo.png"/> use <img src="www.mywebsite.com/logo.png"/>" and you will have no problem in the future.

or if you want can use base element this way <base href="http://www.mywebsite.com"> and you can use it the same way you are using it <img src="logo.png"/>