0

The URLs for my website end with .html, .php, or .asp depending on the types of files to which they relate - and show in my browser's address bar as such; but I do not want the file extensions to show.

For example, I would like a URL for a page on my site like

http://my.special.site/somepage.php

to instead be:

http://my.special.site/somepage

I have read about using .htaccess to do this but do not really know where to start.

How are URLs like https://stackoverflow.com/questions/ask (i.e. that do not end with a file extension) made?

Community
  • 1
  • 1
Ayesha
  • 125
  • 1
  • 10
  • 1
    It is done via URL re-writing technique, for Apache - look into `mod_rewrite` – B-and-P Sep 25 '14 at 02:34
  • This is done with URL re-writing in .htaccess – Russell Bevan Sep 25 '14 at 02:37
  • Note: It's possible that ask is a directory which contains a file called index.html. That will show up as `/ask` – Nick Manning Sep 25 '14 at 02:46
  • @Sam why -1 . I don't know what is .htaccess thats why i posted my question. – Ayesha Sep 25 '14 at 02:48
  • 1
    I didn't -1, but I did put in a close vote for a duplicate question. No worries about knowing, but moderators still want to keep the site clean. No sense in having two questions that answer the same thing when one has been seen and edited many times :) – Sam Sep 25 '14 at 02:50
  • I did, for lack of research, this is a very common question both on S.O and the rest of the internet. –  Sep 25 '14 at 02:53
  • @Arif_suhail_123 How to try code when i have no idea about it. I even don't konw whether this feature is in php or in javascript – Ayesha Sep 25 '14 at 03:05
  • @NickManning What happened? Your answer is removed. I was going to vote up your answer. – Ayesha Sep 25 '14 at 03:12
  • Thanks Ayesha! You're nice. I removed it bc people were giving me hate and downvoting it...I can't afford downvotes because I have a question ban. I commented it though...see comment above. – Nick Manning Sep 25 '14 at 03:16

1 Answers1

-2

It depends what kind of webpage it is. Subpages made from online wesite-making-tools like Weebly will most likely end in .html, or when you click on a home button on some pages it might take you to for example "example.com/default.asp". Yet on most newer webpages (not saying that Weebly webpages aren't new, but like Codepen for example) the subpage title will mot be for example "example.html" or "example.asp" or "example.php".
Even if your webpage ends in .html or .php in will not make a difference in your webpage's performance.

Hope this helps!