Hello Stackoverflow Community, I have built a website using HTML & CSS only, now it is live. Whenever I want to update it I just replace the files in File Manager in cPanel. Everything was perfect until I had to edit the .htaccess to remove the (.html) extensions from URLs. My problem is that href="about-us" without the .html don't work locally so I cant just replace the files in cPanel, now I have to remove .html from all links in all pages in File Manager. I have to do this every time I update the website. Is there a way around that? like a local server that can understand links like href="http://example.com" or href="about-us"? any suggestions? Thank you
Asked
Active
Viewed 162 times
0
-
Don't remove .html. Are you trying to get your url to look like this: `example.com/about-us` instead of `example.com/about-us.html`? – Vanity Slug - codidact.com Aug 07 '17 at 19:54
-
you trying to do [this](https://stackoverflow.com/questions/5730092/how-to-remove-html-from-url)? – Vanity Slug - codidact.com Aug 07 '17 at 19:57
-
Yes, I have done it and it works. what about locally? also I want to link to home page using a URL and not using index.html or index – MEGA Aug 07 '17 at 20:00
-
I can't reproduce your case at the moment, but perhaps you could run your website on [XAMPP](https://www.apachefriends.org/index.html) locally and temper with settings in XAMPP to try to get short url. [This question](https://stackoverflow.com/questions/24472349/htaccess-doesnt-work-on-xampp-windows-7) might be relevant. – Vanity Slug - codidact.com Aug 07 '17 at 20:08
-
Your local environment is for sure different than the env provided by cPanel/WHM. .htaccess rules should be pretty much the same though as long as you use apache as a webserver locally. As Alex suggested you could use XAMPP – Bogdan Stoica Aug 08 '17 at 05:33
1 Answers
0
Thanks to alex and Bogdan Stocia, I have used MAMP to run it locally and created .htaccess file to be able to view pages without .html extension and replaced <a>
tag linking to my home page with href="/" instead of href="index".

MEGA
- 261
- 1
- 2
- 9