ARNAB ARNAB - 20 days ago 6
PHP Question

Rewrite Rule not working for css, js and images

⁠⁠⁠File structure:

htdoc
|--project
|--admin
|--css
|--js
|--images
|--.htaccess
|--index.php


.htaccess file contain:

RewriteEngine on
RewriteBase /project/admin/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?PATH_INFO=$1 [L,QSA]


When I going through the following link every thing is working properly.

localhost/project/admin/profile


But when I going through the following link the css js and images are not loading

localhost/project/admin/profile/


Index.php
the css link is like that

href="css/style.css"


Please help.

Answer

You have to just use full path to call css/js/images from a redirected page. eg: http://localhost/project/admin/css/style.css

Comments