What is the purpose of using .htaccess in PHP development?

The purpose of using .htaccess in PHP development is to configure the Apache web server to control access to directories and files, rewrite URLs, set custom error pages, and other server configurations. It allows developers to easily manage server settings without needing to modify the main server configuration file.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]