lewerjason Posted August 18, 2011 Report Posted August 18, 2011 Dear Members, I wanted to know if it's possible to hide url extension. Eg. about.htm, contact.htm. I just want to see only the web address. Eg. http://www.site.com/ even if I click on about.html link. I wouldnt want to see it as http://www.site.com/about.htm Any suggestions? Quote
Wickham Posted August 18, 2011 Report Posted August 18, 2011 (edited) You need to add a .htaccess file to your server or add the code to a .htaccess file that is there already. You need an Apache server to use .htaccess http://www.blogstorm.co.uk/htaccess-mod_rewrite-ultimate-guide/ The above tutorial is to delete index.html from the url (as well as doing other things as shown to make www the same as no www) but you can edit and repeat for any filename and you can leave it like www.mydomain.com/about instead of www.mydomain.com/about.html You may need to google a general .htaccess tutorial as it can be quite tricky. I have heard that it can be difficult to upload .htaccess as it starts with a . period, so in that case save and upload as temp.htaccess and edit on the server to just .htaccess Edited August 18, 2011 by Wickham Quote
falkencreative Posted August 18, 2011 Report Posted August 18, 2011 One other thing you can do, if you are working on a small site... You can have a separate folder for each page, each folder containing an "index.html" file, and then link to the folder itself, rather than the file name. For example, here's a sample file structure: -- index.html (your home page) -- about folder ------ index.html (your about page) -- contact folder ------ index.html (your contact page) If you were linking to these files, you'd want to link to "/" (home page), "/about" (about page) or "/contact" (contact page). The server is smart enough to look for the default file within each folder, and the "index.html" part will never show in the browser unless you specifically link to the file name. Quote
DanExcel Posted August 18, 2011 Report Posted August 18, 2011 I agree with Ben, that is perhaps the best solution. Like you, I was pulling my hair out trying to hide extensions for a small site using .htaccess several years ago and was not successful. Your files most like have to be dynamic in the sense that it has to be interpreted by a server. Quote
lewerjason Posted August 19, 2011 Author Report Posted August 19, 2011 Thanks All for the info. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.