What are the necessary server requirements for mod_rewrite in PHP?

To use mod_rewrite in PHP, you need to have the Apache web server installed and configured to allow the use of .htaccess files. Additionally, the mod_rewrite module must be enabled in Apache. You can check if mod_rewrite is enabled by looking for the module in the list of loaded modules in your Apache configuration.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</IfModule>