If you are using an Apache server
You can do this creating a .htaccess in your web application root directory with this content:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?p=$1 [QSA]
If you have more than one site on your root folder, like this:
| root
|_ web1
|_ web2
|_ web3
you need to add a .htaccess file only to the folder that you want to enable rewrite rules, example:
| root
|_ web1
|__ .htaccess
|_ web2
|_ web3
Note: To use the above solution, you need to enable .htaccess module
in Apache2.
In your apache2>sites-available>default or
apache2>sites-available>your_config, set AllowOverride to 'All':
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Note: (Edit the code above according to your existing code.)
If you are using a Nginx server
You need to add these lines to your nginx server config!
if (!-f $request_filename){
set $rule_0 1$rule_0;
}
if (!-d $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite /(.*) /index.php?p=$1;
}
If you are using a Windows IIS Server
You need to add a web.config with these rules (I suggest to use the URLRewrite 2.0 in IIS Control panel to add these l
<rule name="rule 1Z">
<match url="(.*)" />
<action type="Rewrite" url="/index.php?p={R:1}" appendQueryString="true" />
</rule>