I have a website with 000webhost, and I was wondering how I can get a url like this: Website.com/ITCMDN
to forward to Website.com/ITCMDN.html
Like I don't want people to have to type in the .html
part, and I know this must be possible. Should I put something in my Index.html? Thanks!
Asked
Active
Viewed 64 times
-2

Mark Deven
- 550
- 1
- 9
- 21
-
This has nothing to see with PHP nor HTML, it depends on you web server – gogaz Dec 17 '17 at 12:47
-
I think its PHP 5 – Mark Deven Dec 18 '17 at 12:24
-
@gogaz routing can and does happen in php too. Indeed, it's possible to do from the server, but php side routing allows for much more liberty. – Félix Adriyel Gagnon-Grenier Nov 13 '18 at 16:16
1 Answers
1
Try placing this in your .htaccess
file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]

The Codesee
- 3,714
- 5
- 38
- 78
-
gives me error 404, and even though ITCMDN.Html exists, its now not letting me open that either (www.Website.com/ITCMDN.html) – Mark Deven Dec 18 '17 at 12:28
-
1@MarkDodsons Apologies. Please try taking a look at https://stackoverflow.com/questions/5730092/how-to-remove-html-from-url for other answers – The Codesee Dec 18 '17 at 16:01
-
I figured it out here: https://www.000webhost.com/forum/t/remove-html-extension-not-working/101235 – Mark Deven Dec 26 '17 at 16:13