So the problem is, when I use only the first parameter, the page works like a charm, but when I use the second one, my CSS gets messed up (text alignment -> left)
That's because you're using relative paths instead of absolute paths for all your html links (images, javascript, css, href links).
Actually, your rules create virtual directories.
That's why i'm surprised dummy.com/mode/
(with trailing slash) also works.
Let's say you have css links that way
For all your examples, here is the path resolution
dummy.com/mode
-> /css/style.cssdummy.com/mode/
-> /mode/css/style.cssdummy.com/mode/user
-> /mode/css/style.cssdummy.com/mode/user/
-> /mode/user/css/style.cssCan you see the problem now ?
To avoid that behaviour, use absolute path
Or, if you don't want to change all your html links, you can add this line after html tag
Note 1: assuming for absolute path that everything was in root folder.
Note 2: you should add a RewriteBase
in your htaccess (to avoid same problem with virtual directories)
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^([\w-]+)/([\w-]+)/?$ index.php?mode=$1&user=$2 [L]
RewriteRule ^([\w-]+)/?$ index.php?mode=$1 [L]
Note 3: you should avoid /?
in the end of your rules (which means /
is optional) because it creates 2 different urls with same content (this is called duplicate content and that's not good for search engines).
Make a choice: with or without trailing slash but not both.