0

how to make this url(https://justinsimdev.com/about-us.html)become this url(https://justinsimdev.com/about-us)

basically just remove the .html from the link.

anyone can help me solved this problem.

I'm a self-taught web developer.

JUSTIN
  • 11
  • just edit .htaccess in the server. heres what to do: https://stackoverflow.com/questions/5730092/how-to-remove-html-from-url – Atif Khan Oct 10 '22 at 04:48
  • 1
    Does this answer your question? [How to remove .html from URL?](https://stackoverflow.com/questions/5730092/how-to-remove-html-from-url) – Rob Oct 10 '22 at 10:11

1 Answers1

0

To remove the .html extension from your urls, you can use the following code in root/htaccess :

RewriteEngine on


RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ /%1 [NC,L,R]

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]

NOTE: If you want to remove any other extension, for example to remove the .php extension, just replace the html everywhere with php in the code above.

Also see this How to remove .html and .php from URLs using htaccess`. https://helponnet.com/2020/02/04/remove-html-and-php-extension-with-htaccess-rewriterule-url-rewriting-tips/