Hide index html from url
Ok, maybe a pretty dumb question but I can't find an answer on Google. Show I am coding my site by hand. How do I make the index.html disappear from the url's? Do I use a piece of code in my html? Do I have to change my href's in my files? Hope you guys can help! EDIT: I've tried this with a .htaccess file
It does work, but all my links aren't working anymore. I discovered I had to remove all the index.html from the href's in my documents. But that would be a lot of work. Is there an other code for .htaccess that just hides index.html? asked Mar 18, 2014 at 13:34
David HakkertDavid Hakkert 6493 gold badges10 silver badges24 bronze badges 7 A SIMPLE WAY TO DO THIS in Html: (example in my case is a simple dual language site) If your link looks like this:
You should change it to this:
If trying to link to another folder in your directory, like is my example:
You should change it to this:
Notice that "/" goes back to your root directory and automatically selects index.html, so that is why I used "en" for the English language site, because the name of the folder in that case is "en". You should also make sure that you have index.html in your English language folder, and not index-en.html. answered Jan 29, 2015 at 18:16
2 Apache has .htaccess files and mod_rewrite, In your .htaccess file, set:
You can also set this up in the Apache site config files too You can specify a list of filenames, so if it doesn't find the first it moves to the next. IIS has .config files answered Mar 18, 2014 at 13:46
vogomatixvogomatix 4,7042 gold badges19 silver badges42 bronze badges 2 mod_rewrite module is responsible for all the rewriteEngine. Check on your server whether is module is present and enable. answered Mar 28, 2017 at 7:26
murtuza hussainmurtuza hussain 4231 gold badge7 silver badges18 bronze badges
You need to create a file called '.htaccess' in the root directory of your site containing the following code:
And then make sure all the links on your site don't contain '.html' at the end, e.g.:
should be replaced with:
Hope this helps! if you dont find .htaccess, you just need to create a new file using your text editor the same way you would any other html or css file, but save it as simply '.htaccess' And save it into the root directory, so the same folder that you have your index.html file. answered Mar 22, 2019 at 8:03
I think this is configured in IIS when you deploy the site, I'm not to sure on it but I'm sure you can specify a start point that your URL will use when you just enter the UL, that implies the Index.html page. Sorry I'm not too helpful here, hopefully it will point you in the right direction. Often these things such as Apache or IIS have this set up already, and it looks for the
hatef 4,60328 gold badges44 silver badges43 bronze badges answered Mar 18, 2014 at 13:39
Joe HarperJoe Harper 4602 silver badges11 bronze badges Great SEO idea! This is similar to nginx redirect loop, remove index.php from url and Apache .htaccess to hide both .php
and .html extentions, as well as mod_rewrite not working htaccess — the idea here, for both Apache's mod_rewrite and nginx ngx_http_rewrite, depends on the differences between the external and internal URLs — in order for the redirect from Here's the code for nginx ngx_mod_rewrite:
On Apache's mod_rewrite, it'll be something like the following:
Related:
References:
answered Dec 18, 2019 at 20:45
cnstcnst 24.5k4 gold badges84 silver badges117 bronze badges Change the link that goes to your homepage to the website address. You may have:
Change that to:
Or try this answered Mar 18, 2014 at 13:38
AlexanderFTAlexanderFT 811 gold badge2 silver badges13 bronze badges 2 Simply don't type the index.html in your browser and don't advertise it as such. You can set the 'default document' on the web server (whichever you happen to be using) to serve 'index.html' in the absence of a file part. This way, someone going to http://www.mysite.com would be served http://www.mysite.com/index.html answered Mar 18, 2014 at 13:39
Steve MartinSteve Martin 1,61210 silver badges19 bronze badges 1 Can I remove .html from URL?The . html extension can be easily removed by editing the . htaccess file. .
How do I hide a URL in html?Type "" after the link word or phrase to close off the link. Your code should now look like this: LINK NAME , but will appear on your website as "LINK NAME" with the URL hidden.
Can you delete index html?In general You can remove those index. html files but you need to be sure that directory index is disabled in you web server configuration. Those index. html files in CodeIgniter prevent (in any case) directory listing wich can lead to serious security flow.
Why does my URL have html at the end?. html extension means that page contains only front-end code and does not have any server side language included in it (I'm not talking about URL rewriters that adds . html to the end of virtual path).
|