Redirections or coding Info

Hey. I have html website using infinityfree Host

I have website lemme tell what i want to do i have everylinks with .html
Like - about.html , blog.html .and some profile.php

I want to update if somones removes that.html extention, and .php extention that page still work even it dont have .html or .php extentions is this possible using .htaccess or Js?

Please tell me if possible


Yes, removing the .html and .php extension from the URL is possible. All you have to do is create a .htaccess file inside the /htdocs folder and paste the following code inside of it.

RewriteEngine On

RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,L,NC]

Please let me know if you have any questions!


no not working -_-
maybe have some errors
try : Dopenews : Lyrically Videos, Songs Lyrics, Shabad Gurbani Videos, Bassboosted Songs

this fixed my issue

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^([^\.]+)$ $1.html [NC,L]

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.