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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.