Link to pages on site without .html extension appearing in browser?

Link to pages on site without .html extension appearing in browser? - .htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about htaccess, redirects, url, mod-rewrite, .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :


I've modified my .htaccess file to allow access to html files without having to include the extension on the end, for example:



www.mysite.com/document


directs to



www.mysite.com/document.html



However, when I want to link to pages within my site using something like <a href="page.html"></a> I still get the .html appearing in the URL.



So am I allowed to exclude the extension and leave a link as <a href="page"></a> so that the extension doesn't appear in the browser? Or is there a better way to do it?


Solution :

Yes, make your links match your URLs.


Additionally, if you would like to do some further testing, give the htaccess tester tool a try. It allows you to specify a certain URL as well as the rules you would like to include and then shows which rules were tested, which ones met the criteria, and which ones were executed.

Comments

Popular posts from this blog

Rewrite in Mediawiki, remove index.php, .htaccess

.htaccess rewrite wildcard folder paths from host

Using .htaccess to set a cookie and 301 redirect