all my php files in theme folder, and images in images folder http://localhost/theme/ http://localhost/theme/images I use .htaccess rewrite my ugly url. http://localhost/theme/category.php?type=movie http://localhost/theme/category/movie url works, but all the images in the category.php file cannot be displayed. in the header.php file, I use <img src="images/logo.jpg"> now, after I rewrite the url, this image file cannot be found. cause, it try to find http://localhost/theme/category/images/logo.jpg and category acutally does not exist. I can change it to <img src="../images/logo.jpg">, but problem is header.php is the header file used for all other files. index.php also use it,http://localhost/theme/index.php if i change it to ../images/logo.jpg, then index.php couldnt find this image file. is there a way to give the correct image path for all the files ?
Because the browser thinks its in another directory. Use the full or absolute URL in your src attribute.
or use rewrite conditions to get around it, generally you can get away with using something like RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f // your rewrite rule Code (markup): !-d instructs apache to rewrite the url if the directory requested does NOT exist on the server !-f instructs apache to rewrite the url if the file requested does NOT exist on the server if you post your htaccess, I'll fix it.
Hi, Please find the attached .htaccess it doen't works with the modifications. Help is needed. Many thanbks by advance ! Michel View attachment Htaccess.rar.txt