I've domain and i'm attempting to forward virtual folder to recognize company e.g

www.domain.com/CompanyA
www.domain.com/CompanyB

CompanyA and CompanyB folders don't exist, and that i want that being the querystring e.g

www.domain.com/?CompanyA etc..

How do you do that with mod_rewrite?

Thank you,

Add the next RewriteRule:

RewriteRule ^/([A-Za-z]+)$ /?$1

This can capture any sequence of a number of lower and uppercase letters in to the first match group (that may be utilized by $1). You might then use $one in the 2nd parameter from the rewrite rule to mean the string matched up. For instance, you could utilize:

RewriteRule ^/([A-Za-z]+)$ /render.php?page=$1

if you wish to make use of a file apart from your index.php (or equivalent) to handle conditional rendering logic.

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^(.*)$ /index.php?query=$1 [L,QSA]

QSA allow you to keep incoming query string intact.