hide file extension in the url

Problems with the Windows version of XAMPP, questions, comments, and anything related.

hide file extension in the url

Postby CodeVisio » 06. August 2012 14:01


I'm new of xampp and apache.

I'd like to hide the extension of my pages when a user is navigating my web site.

Current situation:
1) I successfully installed xampp 1.8.0 on my Windows 7 (x64). the folder is c:\xampp.
2) I successfully created a web site with few html pages, plus some images and a php file.
3) The web site works fine, but while browsing it in local, I see my web pages in the URI with their extensions. For example http://localhost/en/mypage.html.

How is the structure of my web site folders in local:
|-----------en (folder)

en folder contains my web pages localized for the English languages. Inside htdocs I have an Index.php file. inside it I have put some php code to redirect the browser to the appropriate folder based on the browser language. So if it is an English firefox then the en/home.html file is loaded, if it is a Dutch one the the du/[home in dutch].html etc.

I've tried some solution for hiding file extension around internet but they didn't work for me. That is, writing some rules inside an .htaccess file inside htdocs folder. The extension was still there.

Any idea?

Thank you
Posts: 1
Joined: 06. August 2012 13:45
Operating System: Windows 7 (x64)

Re: hide file extension in the url

Postby Altrea » 06. August 2012 15:54

Hi CodeVisio,

You have a few possibilities to hide parts of the url:
  • Create a frontcontroller with PHP to implement the needed ressources on runtime instead redirect the request (as you do now)
  • use mod_rewrite (for example with a .htaccess file) to rewrite the request
  • use HTML Frames to load parts of the webpage (the url will always stay the url of the frame site.

I will not get too much into detail because i think it is beside the topic of this board here. It is no XAMPP issue.

best wishes,
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
AF Moderator
Posts: 8409
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Return to XAMPP for Windows

Who is online

Users browsing this forum: Ishutaru and 40 guests