What are the benefits of using URL rewriting in PHP for SEO purposes?

URL rewriting in PHP for SEO purposes helps to create clean and user-friendly URLs that are easier for search engines to understand and index. By rewriting URLs, you can include relevant keywords in the URL structure, which can improve the overall SEO performance of your website. Additionally, URL rewriting can help to make URLs more memorable and shareable, leading to potential increases in organic traffic.

// Enable URL rewriting in PHP
if (!empty($_SERVER['REQUEST_URI'])) {
    $url = $_SERVER['REQUEST_URI'];
    $url = explode('?', $url);
    $url = rtrim($url[0], '/');
    $_SERVER['REQUEST_URI'] = $url;
}