Others, Web Hosting

How to Create a User-friendly URL Using htaccess

How to Create a User-friendly URL Using htaccess

If your website uses a long URL such as example.com/files/folder/sitemap.html, you can use an .htaccess rule to present a shorter URL such as example.com/sitemap.

Add the rewrite rule to your .htaccess file

Modify the example paths to match your website, then add the following code to the relevant .htaccess file:

RewriteEngine on
RewriteRule ^sitemap/$ /files/folder/sitemap.html [L]

Before saving the file

  • Replace the example URL paths with the paths used by your website.
  • Keep a backup of the existing .htaccess file before making changes.
  • Test the shorter URL after saving the file.

Current Category

Find The Perfect Domain Name

www

Other Knowledge Articles