Safe, production-ready defaults for non-framework PHP websites.
In a custom PHP site, you often want a "Front Controller" pattern. This means no matter what the user types (e.g., yoursite.com/profile), Apache sends the request to index.php. Your PHP code then looks at $_SERVER['REQUEST_URI'] to decide what content to show.
Developers building their own custom PHP applications who want clean URLs and basic security without a heavy framework.
If your site consists of simple, static .php files (like about.php, contact.php) and you want users to visit those exact filenames.
Ensures that if someone visits /page?id=123, the id=123 part is passed along to your PHP script.
Tells Apache: "If the user is asking for a file that actually exists (like logo.png), just give it to them. Don't redirect it."
A safety net that blocks anyone from trying to read your configuration files or error logs in their browser.
.htaccess file should be placed in the root directory of your website.
This folder is commonly named public_html, htdocs, or www
depending on your hosting provider.
.htaccess file. This can be caused by typos, unsupported rules, or hosting restrictions.
Try removing advanced directives like Options -Indexes first and test again.
mod_rewrite module must be enabled for routing rules to work.
On most shared hosting providers, this is enabled by default.
On VPS or local servers, it may need to be enabled manually.
.htaccess rules. However, some providers restrict certain directives,
which can cause errors. Always check your hosting documentation if something fails.
.htaccess file on every request,
so changes usually apply instantly. If you do not see updates,
try clearing your browser cache.
.htaccess file before making changes,
so you can quickly restore it if needed.