Options +FollowSymLinks -MultiViews -Indexes
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [L,NC]
The problem I am facing is that ;
Lets say I have a URL: /test.php. When I visit /test it works fine. But when I visit /test/ it open the page but the CSS and JavaScript file doesn't works and all the images are not displayed.
Please help me.
That’s a relative URI resolving issue (see mod_rewrite URL info required for details).
You’re probably using relative URI paths to reference the external resources. Try to use absolute URI paths (
/foo/barinstead offoo/baror./foo/bar) if possible.