Just completing Guilherme's answer.
If you need to redirect other URLs, you can do something like:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Remove qualquer possível / no final da URL:
RewriteRule ^(.*)/$ /$1 [L,QSA]
# Casa as URL /stream/foo para /pages/stream.php?a=foo:
RewriteRule ^stream\/(.*)$ /pages/stream.php?a=$1 [L,QSA]
# Casa as URL /foo para /pages/foo.php:
RewriteRule ^(.+)$ /pages/$1.php [L,QSA]
# Casa a URL / para /pages/index.php:
RewriteRule ^$ /pages/index.php
Thus, the following redirects occur:
site.com/ => site.com
site.com => /pages/index.php
site.com/foo/ => site.com/foo
site.com/foo => /pages/foo.php
site.com/foo/bar => /pages/foo/bar.php
site.com/stream/ => site.com/stream
site.com/stream => /pages/stream.php
site.com/stream/foo/ => site.com/stream/foo
site.com/stream/foo => /pages/stream.php?a=foo
This answer completes the other user's question , which is pretty much the same as this, but , if you change the statement of this, Guilherme's answer may lose its meaning.