RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
I just wonder how can I redirect from non-www to www. So if i open
But that gives performance issues, as such redirect is costly especially on 3G mobile networks: if you can serve the same content in both cases, just use [font="Courier New"]rel=canonical[/font] declaration in your header, and avoid the redirect.