What role does the .htaccess file play in website indexing and search engine optimization?

The .htaccess file plays a crucial role in website indexing and search engine optimization by allowing you to control various aspects of your website's configuration, such as setting up redirects, blocking specific IP addresses, and improving site performance. By properly configuring your .htaccess file, you can ensure that search engines can crawl and index your website effectively, leading to better visibility and rankings in search results.

# Example of setting up a 301 redirect in .htaccess
Redirect 301 /old-page.html http://www.example.com/new-page.html