How to Convert to User-Friendly URLs Using .htaccess

How to Convert to User-Friendly URLs Using .htaccess

  • Step 1: Login to your website control panel or access a FTP client.
     
  • Step 2: Navigate to the "File Manager" or connect to your website using FTP.
     
  • Step 3: Navigate to your website's "public_html" directory.
     
  • Step 4: Edit or create the file ".htaccess"
     
  • Step 5: Enter the following code to convert your URL to be user-friendly.
     
# Redirects domain.com/stuff.html to domain.com/stuff
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteCond %{REQUEST_URI} ^(.+)\.html$
RewriteRule (.*)\.html$ /$1 [R=301,L]
Please rate this article to help us improve our Knowledge Base.

0 0