How do i hide the html extension in the address bar?

Hey, today I’ll tell you How To Hide .HTML Extension In Website Address Bar? If you want to know, keep reading this post.

First of all, let me tell you that many people make their website with HTML and PHP, etc, but when it publishes your website, the .HTML extension is displayed in the address bar of the website. Do not look good at that?

How do i hide the html extension in the address bar?

So guys, today we will tell you a way you can hide .HTML Extension by using it. And After that, you can also visit your website .HTML Extension.

Friends, you are appearing in the address bar of your custom website. To hide the .HTML extension, first, you go to the Cpanel of your website. Or go to Public_html and create a file called .htaccess.

Also Read: Best Digital Marketing Company In Dehradun, Uttarakhand?

And Then open this file. And this code which we have given you below. Or It has to be pasted into this .htaccess file.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L] 

Let me tell you that this code can be used only for the website created by HTML. And if you have created a website with PHP, then you can use this code.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L] 

After using Save in this code in the .htaccess file, you can make any URL of your website without .HTML and .PHP extension. You can also see the image given above. For more information, please watch this video.

So hopefully, now you can also hide your website’s .HTML extension using these codes. And if you liked this post, or you have got to learn anything from it. You can tell us in the comment box.

Besides, if you use FacebookTwitter, and Instagram, you can follow us there too. Because we keep updating it even daily. And thank you very much for reading How To Hide .HTML Extension In Website post.

How can I hide my page name and extension in the address bar?

For example when I click on my "Home" link, it would take me to:

www.mysite.com/index.html

but instead I'd like it show in the address bar without the page name and extension, like this:

www.mysite.com/

RAN

1,4433 gold badges19 silver badges30 bronze badges

asked Jul 12, 2012 at 5:32

3

this should work.

Put this in a file called .htaccess and put it in your root directory. Only works on a apache webserver though and not locally.

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule .* $0.html

answered Jul 12, 2012 at 5:49

How do i hide the html extension in the address bar?

TschallackaTschallacka

26.8k13 gold badges89 silver badges130 bronze badges

How are you writing your "Home" link?

Having said that, don't include the /index.html portion in your anchor tag.

Also, if you wanted to show the main site URL www.mysite.com for every local link in your site no matter the webpage your at (photo gallery, about us, etc.), wrap your whole website in a iframe that's the entire space of the viewport which will prevent the Address Bar from changing.

Reference: jsFiddle or is it???

The above jsFiddle site shows this simple iframe method described. Notice that the Address Bar is always at the same place since the iframe is receiving all the navigation interaction.

View that jsFiddle without the /show/ as seen in the Address Bar to access the Edit Page.

answered Jul 12, 2012 at 6:03

arttronicsarttronics

9,9372 gold badges25 silver badges62 bronze badges

0

Create an .htaccess file in your website's root directory with the following content:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

When you've added the above file you can access the following url:

www.mysite.com/index.html

by using this url:

www.example.com/contactus

answered May 17, 2016 at 7:43

How do i hide the html extension in the address bar?

You can try:

window.location.href = 'WHAT LOCATION YOU WANT';

But this will reload the page. You should find the solution on the server side.

answered Jul 12, 2012 at 5:43

micnicmicnic

10.4k5 gold badges42 silver badges55 bronze badges

How do I hide an extension in html?

html extension can be easily removed by editing the . htaccess file. .

How do I hide the URL in the address bar in html?

Domain masking is fairly easy to implement by:.
Log in to cPanel and look under “File Manager”..
Locate “public_html”.
Look for the file named “index. ... .
Right click the index. ... .
You may select and use the “Use Code Editor” to have a better view on code..
Edit the Code below and paste to index.php/index/html..

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).

How do I hide html in a website?

After encrypting it, you can just write a basic HTML page just putting into the tag once again the script to disable the right click, into the tag you code and hide everything just writing at top of the page .