@domenico.weimann
To implement an SEO-friendly URL with PHP, you can follow these steps:
1
|
RewriteEngine On |
Here's how you can rewrite the URL using PHP:
1
|
RewriteRule ^articles/(.*)$ article.php?title=$1 [L] |
In the above code, the regular expression "^(.*)$" matches any characters after "articles/" and captures it as a parameter named "title". The [L] flag indicates that this is the last rule to be applied.
1 2 |
$title = $_GET['title']; // Use the $title to retrieve the corresponding content from the database |
By implementing these steps, you have created an SEO-friendly URL structure for your website using PHP. However, keep in mind that you may need to adapt the code based on your specific requirements and website structure.