Problems with mod_rewrite and php

I am trying to convert links to my applications, so a link like this:

http://localhost/index.php?id=13&category=Uncategorized&title=just-a-link

converts to this:

http://localhost/13/Uncategorized/just-a-test

so far I could do this using:

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /index.php?id=$1&category=$2&title=$3 [QSA,L]

but this completely breaks links to css and other files as it redirects every request with a request to index.php

so I changed it a bit so that it only starts when the first request is a number:

RewriteEngine On
RewriteRule ^([0-9]*)/([^/]*)/([^/]*)$ /index.php?id=$1&category=$2&title=$3 [QSA,L]

this file does not break css and js files, however, when you go to a link, for example http://localhost/13/cat/test, try switching to another link, for example http://localhost/19/Uncategorized/something , clicking on it inside the previous page will instead redirect you to something likehttp://localhost/13/Uncategorized/19/Uncategorized/just-a-test

How to achieve what I described without any of these strange side effects?

+4
1

:

RewriteEngine On
RewriteRule ^([0-9]+)/([^/.]+)/([^/.]+)/?$ /index.php?id=$1&category=$2&title=$3 [QSA,L]

html <header>:

<base href="/">

<base href="http://www.domain.com/">

css js

+2

All Articles