0

How do I go from URL that reads example.com/text.html to one that reads example.com/text?

Edit: Sorry I'm new. The website is coded in HTML and hosted by GoDaddy on a Windows server. I would like to edit this server-side if possible but if not then in individual webpages (with an html snippet)

Hunter
  • 67
  • 2
  • 3
  • 10

3 Answers3

0

Totally depends on what you have - Apache? Then mod_rewrite: http://httpd.apache.org/docs/current/mod/mod_rewrite.html E.g. http://www.sitepoint.com/apache-mod_rewrite-examples/

If you have a Java server, then every framework has freedom to do it on it's own.

Also Ruby, Python, ASP have their own.

Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
0

add the foillowing line to your .htaccess file:

RewriteRule ^(.*)\.html$ $1 [R=301,L]
Nir Alfasi
  • 53,191
  • 11
  • 86
  • 129
0

You can make a folder named name of file and put index.html's inside.

Sample:

If you want to to make www.example.com/test.html to www.example.com/test rename test.html to index.html and put it inside folder test

Root folder
|
|-->index.html "home page"
|
|
|-->sample page folder 1 "Page 2"
|   |
|   +-->index.html
|
|-->sample page folder 2 "Page 3"
|   |
|   +-->index.html
|
+-->sample page folder 3 "Page 4"
    |
    +-->index.html
NatureShade
  • 2,187
  • 1
  • 19
  • 27