Reputation: 175
I would like change my URL from
www.example.com/collections.php?id=abc123
to www.example.com/collections/abc123
I use .htaccess
like this:
Options -Indexes
RewriteEngine On
RewriteRule ^collections/(\w+)/?$ collections.php?id=$1 [QSA,L,NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Now, when I type www.example.com/collections/abc123
in browser, my webpage shows without loading any css files or script.
can someone point out what is missing ?
Thanks a lot.
Upvotes: 0
Views: 175
Reputation:
Well, apparently you're using a relative path in referencing your scripts. So, what's happening is your browser is attempting to fetch those resources wrongly because of that additional /
in the url, causing it to think you navigated to a different directory.
What you could do here is specify absolute paths instead.
An example would be http://example.com/css/style.css
as opposed to /css/style.css
Upvotes: 1