my first page in my website called index.html
when I put in the address bar :
http://websit/index.html
it works
but
now my boss asked me that he wants the name just http://websit/index
how can I do that?
my first page in my website called index.html
when I put in the address bar :
http://websit/index.html
it works
but
now my boss asked me that he wants the name just http://websit/index
how can I do that?
Standard web server behavior is to just load the "index.html" file as the root file of a path call. Meaning this:
http://websit/
Is the same as this:
http://websit/index.html
Doing something like this (below) will only cause more problems since it would seem that index is a path instead of a file:
http://websit/index
So any if you want to clean things up just make any reference to http://websit/index.html
just http://websit/
If you are using Apache, then, you need to check if Mod Rewrite is enabled, and then, read articles about .htaccess and mod rewrite.
The solution: Create a file with this name exactly .htaccess on root directory (where the index.html) is there. Then, copy this code (paste it inside the .htaccess file) and test it again using website/index without .html
#comments
RewriteEngine On
#base directory for this file, if its root, then its one /, if its test then its /test
RewriteBase /
#if the URL for the resource that requested is not exist as file
RewriteCond %{SCRIPT_FILENAME} !-f
#if the URL for the resource not exist as directory
RewriteCond %{SCRIPT_FILENAME} !-d
#then it anything types after the website/() redirect it to ().html
RewriteRule ^(.*)$ $1.html [NC,L]
#the ^ and $ used for matching whole string (from beginning to end)
#the () used for grouping matching strings
#the . used for matching any character
#the $1 represents the match group, for our example we used one () then its $1
[1] http://httpd.apache.org/docs/current/howto/htaccess.html