简体   繁体   中英

hide index.html in the URL

I just saw the site The Geek Designer and love his URL. when you click on a navigation point, eg about, the URL display /about/ . Without index.html at the end.
so i tried it for myself:
i create the directory about with only one index.html file inside. and create the hyperlink:
<a href="http://www.abc.com/about/>
but the URL display /about/index.html !

So how can i hide the index.html? i do not use PHP and can't edit the .htaccess file!

If you are using Apache this might help you mod_rewrite: A Beginner's Guide to URL Rewriting Article

If you htaccess file then add

RewriteEngine On
RewriteBase /
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ $1.html [NC,L]

也许您可以尝试在.htaccess文件中进行URL重写?

You make folders on your servers and put your index there (with all the files needed). Ex: "www.example.com/prices", where "prices" for example, is a folder. It will not show index.html in adress bar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM