Htaccess RewriteBase explaination

RewriteBase /ps
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Can someone please explain exactly what this code does?
Can I place it under root folder?

The RewriteBase changes EVERYTHING as it requires index.php to be in the ps subdirectory. Best NOT to use RewriteBase.

RewriteCond %{REQUEST_FILENAME} !-f

This will examine the ORIGINAL REQUEST to see whether the file exists.

RewriteCond %{REQUEST_FILENAME} !-d

Ditto for a directory

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

IF the file and directory do not exist, then this will capture the {REQUEST_URI} and redirect it to /ps/index.php with a query string whose key “q” is assigned the value of the {REQUEST_URI}. Because mod_rewrite will cycle again to find any more links, it’s quite likely that this will generate a loop as {REQUEST_FILENAME} will not change (use {REQUEST_URI}).

Learn all this and more in my signature’s linked tutorial.



thank you,
so this will work as long as I have index.php in ps/ will not interfer with other folders,…
I found this code from someone who uses this technique to dynamically generate landing pages.

it will display on index.php session variables thekeyword.