How can ModRewrite be used for dynamic pages in PHP?
ModRewrite can be used to rewrite URLs for dynamic pages in PHP by creating rules that map user-friendly URLs to the actual PHP files that generate the content. This can help improve SEO and make URLs more readable for users.
```php
RewriteEngine On
RewriteRule ^products/([0-9]+)/?$ product.php?id=$1 [NC,L]
```
In this example, the rule will rewrite a URL like "example.com/products/123" to "example.com/product.php?id=123", allowing the PHP script to dynamically generate content based on the ID provided in the URL.
Related Questions
- Are there specific database tables that need to be modified when connecting website registration to a phpBB3 forum?
- How can session management be improved in the PHP script to ensure that user data is correctly retrieved and stored in the database?
- What are the potential pitfalls of using nl2br function in PHP when dealing with text fields and line breaks?