Css, js and image not working when I use / (slash) in .htaccess

Doesn't affect my css, js and image when loading http: // localhost / project / book / 4

How do I get this to work on my website?

.htaccess

Options +FollowSymlinks
RewriteEngine on
RewriteRule book/([0-9]+)/ book-detail.php?id_=$1

      

+3


source to share


1 answer


Ideally, you should use absolute paths, or add this to a section <head>

on the HTML page:

<base href="/" />

      



Otherwise, you can add this additional rule to fix the css / js / image paths:

RewriteRule ^book/(.+?\.(?:jpe?g|gif|bmp|png|tiff|css|js))$ /$1 [L,NC,R=301]

      

0


source







All Articles