1

There are 1 best solutions below

5
On

Try this:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/(images/|css/|js/)
RewriteRule . - [S=2]

RewriteRule ^([a-z0-9_\-\.]+)/?$ index.php?page=$1 [L,NC,QSA]
RewriteRule ^([a-z0-9_\-\.]+)/([a-z0-9_\-\.]+)/?$ index.php?page=$1&item=$2 [L,NC,QSA]

Make sure mod_rewrite is enable

edit: I added the dot, poolie had a good point there.

The [S] flag is used to skip rules that you don't want to run. This can be thought of as a goto statement in your rewrite ruleset. In the following example, we only want to run the RewriteRule if the requested URI doesn't correspond with an actual file.