Reputation: 2352
just a quick one, I'm using this rule and it works fine:
RewriteRule ^([^/.]+)$ /profile.php?id=$1
so whatever come to mysite.com/anything will be read as mysite.com/profile.php?id=anything That's all good.
Then I need to add another variable so I used:
RewriteRule ^([^/.]+)/([^/.]+)$ /profile.php?id=$1&vid=$2
Which kind of works but it doesn't load any css, js, external php... I guess that's why it's looking in a different folder, I don't know how to tell it get those other files from the root folder.
Any ideas?
Upvotes: 1
Views: 88
Reputation: 175098
That's because you are creating virutal folders using the htaccess. If you want to load your CSS and JS properly, either use absolute paths or add ../ before your relative path (which means "one folder up").
Another possibility is to add <base href="www.example.com">
. Which will cause all new requests (for images, external files, etc) to be relative to that path, and not the current address.
Upvotes: 2
Reputation: 565
Add next 2 lines befor RewriteRule
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
Upvotes: 1
Reputation: 47658
You can add
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
to do not rewrite URL if there are files with this URL
Upvotes: 1