What is the purpose of using mod_rewrite in PHP and what are some common applications?
Mod_rewrite in PHP is used to rewrite URLs, allowing for more user-friendly and search engine-friendly URLs. It can be used to redirect URLs, rewrite URLs based on certain conditions, and mask the actual URL of a resource. Common applications of mod_rewrite include creating clean URLs for websites, redirecting old URLs to new ones, and implementing URL routing for web applications.
RewriteEngine On
RewriteRule ^about$ about.php [L]
RewriteRule ^contact$ contact.php [L]
Keywords
Related Questions
- What are the differences in handling file uploads between Linux and Windows systems in PHP?
- What are common errors in the provided PHP script that could lead to the timer resetting when the page is refreshed?
- How can beginners in PHP effectively troubleshoot and solve issues with login forms and database interactions?