{"id":103,"date":"2023-10-06T08:39:39","date_gmt":"2023-10-06T08:39:39","guid":{"rendered":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/?p=103"},"modified":"2023-10-09T06:37:14","modified_gmt":"2023-10-09T06:37:14","slug":"dot-htaccess-explained","status":"publish","type":"post","link":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html","title":{"rendered":"(dot) htaccess explained"},"content":{"rendered":"<div class=\"kb-article-content\">\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\"><strong>Windows<\/strong>: Using Notepad save the file as .htaccess<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\"><strong>Mac OS X<\/strong>: Using TextEdit save the file as &#8220;.htaccess&#8221; <\/span><br \/>\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Note: If you save the file as .htaccess it will be hidden and you will not be able to see it in the Finder.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Using your preferred FTP client upload the file to the server. The .htaccess file will need to be in the folder where your site is located, typically the public_html folder.<\/span><\/p>\n<p><em><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">On the server<\/span><\/strong><\/em><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">1. Login to your <em><strong>cPanel Account<\/strong><\/em><\/span><br \/>\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">2. Click the File Manager icon, located in the Files section.<\/span><br \/>\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">3. From the File Manger popup choose &#8220;Choose Hidden Files (dotfiles).&#8221; <\/span><br \/>\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\"> Note: If you do not see this popup you will need to click the &#8220;reset all interface settings&#8221; link at the bottom of the cPanel page.<\/span><br \/>\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">4. From the File Manager popup choose the folder you would like to open, most often the &#8220;Web Root (public_html\/www)&#8221;<\/span><br \/>\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">5. Click the Go button. <\/span><br \/>\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\"> Note: If you are in the File Manager already you can add &amp;showhidden=1 to the end of the URL.<\/span><br \/>\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">6. Click the New File icon to create a new file and name it .htaccess<\/span><\/p>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Alternative Index Files<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">You may not always want to use index.htm or index.html as your index file for a directory, for example if you are using PHP files in your site, you may want index.php to be the index file for a directory. You are not limited to &#8216;index&#8217; files though. Using .htaccess you can set abcdabcd.xyz to be your index file if you want to!<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Alternate index files are entered in a list. The server will work from left to right, checking to see if each file exists, if none of them exist it will display a directory listing (unless, of course, you have turned this off).<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong>DirectoryIndex index.php index.php3 messagebrd.pl index.html index.htm<\/strong><\/em><\/span><\/span><\/p>\n<p><em><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Custom Error Pages<\/span><\/strong><\/em><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">You can customize your own, personal error pages (for example when a file is not found) instead of using HostITSmart&#8217;s error pages or not having an error page. This will make your site seem much more professional.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">You can use custom error pages for any error as long as you know its number (like 404 for page not found) by adding the following to your .htaccess file:<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong>ErrorDocument errornumber \/file.html<\/strong><\/em><\/span><\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">For example if I had the file notfound.html in the root directory of my site and I wanted to use it for a 404 error I would use:<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong>ErrorDocument 404 \/notfound.html<\/strong><\/em><\/span><\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">If the error page is not in the root directory of your site, you can enter the path to the file:<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong>ErrorDocument 500 \/errorpages\/500.html<\/strong><\/em><\/span><\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">These are some of the most common errors:<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"font-size: small;\"><em><strong>401 &#8211; Authorization Required<\/strong><\/em><\/span><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;400 &#8211; Bad request<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;403 &#8211; Forbidden<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;500 &#8211; Internal Server Error<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;404 &#8211; Wrong page<\/span><\/strong><\/em><\/span><\/p>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Stop a Directory Index From Being Shown<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Sometimes, for one reason or another, you will have no index file in your directory. This will, of course, mean that if someone types the directory name into their browser, a full listing of all the files in that directory will be shown. This could be a security risk for your site.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">To prevent against this (without creating lots of new &#8216;index&#8217; files, you can enter a command into your .htaccess file to stop the directory list from being shown:<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong># disable directory browsing<\/strong><\/em><\/span><\/span><\/p>\n<p><span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Options ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch -Indexes<\/span><\/strong><\/em><\/span><\/p>\n<p><span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# enable directory browsing<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Options All +Indexes<\/p>\n<p><\/span><\/strong><\/em><\/span><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Deny\/Allow Certain IP Addresses<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">To only allow people with specific IP addresses to access your site (for example, only allowing people using a particular network to get into a certain directory) or you may want to ban certain IP addresses (for example, keeping disruptive members out of your message boards).This will only work if you know the IP addresses you would like to ban.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Please keep in mind that most ISP&#8217;s use dynamic IP addresses, so this is not always the best way to limit\/grant access.<\/span><\/p>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Block an IP Address<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong>#Deny List<\/strong><\/em><\/span><\/span><\/p>\n<p><span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;order allow,deny<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;deny from 121.121.121.121 #specify a specific address<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;deny from 121.121.121.121\/29 #specify a subnet range<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;deny from 121.121.* #specify an IP address wildcard<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;allow from all<\/span><\/strong><\/em><\/span><\/p>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Allow an IP address<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong>#Allow List<\/strong><\/em><\/span><\/span><\/p>\n<p><span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;order allow,deny<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;allow from 123.123.123.123 #specify a specific address<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;allow from 123.123.123.123\/30 #specify a subnet range<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;allow from 123.123.* #specify an IP address wildcard<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;deny from all<\/span><\/strong><\/em><\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Note: This will still allow scripts to use the files in the directory.<\/span><\/p>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Redirection<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">There is a tool in the cPanel that can create the Redirects for you, please see How to create a Redirect<\/span><\/p>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Redirect from a specific file to a new file<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Example:<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong>Redirect \/redirect_from.html http:\/\/www.testdomain.com\/folder\/redirect_to.html<\/strong><\/em><\/span><\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">In the above example, a file in the root directory called redirect_example.html is redirected to the URL http:\/\/www.testdomain.com\/folder\/redirect_example.html <\/span><br \/>\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">If the old file were in a subdirectory then you could use:<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong>\/subdirectory\/redirect_from.html<\/strong><\/em><\/span><\/span><\/p>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">WildCard Redirect \/ Redirecting from one folder to a new folder<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong>Redirect \/redirect_from http:\/\/www.testdomain.com\/redirect_to<\/strong><\/em><\/span><\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Now any request to your site below \/olddirectory will be redirected to the new site, with the extra information in the URL added on, for example if someone typed in:<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong>http:\/\/www.testdomain.com\/redirect_from\/images\/image.gif<\/strong><\/em><\/span><\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">They would be redirected to:<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong>http:\/\/www.testdomain.com\/redirect_to\/images\/image.gif<\/strong><\/em><\/span><\/span><\/p>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Redirecting (URL Rewriting) with Joomla<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">To enable URL Rewriting in Joomla you will need to copy and paste the following code into your .htaccess file.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong># For security reasons, Option followsymlinks cannot be overridden.<\/strong><\/em><\/span><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #Options +FollowSymLinks<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Options +SymLinksIfOwnerMatch<\/span><\/strong><\/em><\/span><\/p>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Password Protection<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">One of the many uses of the .htaccess is being able to reliably password protect directories on websites. <\/span><br \/>\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Note: If you would like to use the cPanel tool to password protect your folders please see our article: Password Protect a folder on your website<\/span><\/p>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">The .htaccess File<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Adding password protection to a directory using .htaccess takes two stages. The first part is to add the appropriate lines to your .htaccess file in the directory you would like to protect. Everything below this directory will be password protected:<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"font-size: small;\"><em><strong>AuthName &#8220;Section Name&#8221;<\/strong><\/em><\/span><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AuthType Basic<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AuthUserFile \/home\/username\/.htpasswds<\/span><\/strong><\/em><\/span><br \/>\n<span style=\"font-size: small;\"><em><strong><span style=\"font-family: arial, helvetica, sans-serif;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Require valid-user<\/span><\/strong><\/em><\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">There are a few parts of this which you will need to change for your site. You should replace &#8220;Section Name&#8221; with the name of the part of the site you are protecting e.g. &#8220;Members Area&#8221;.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">The \/home\/username\/.htpasswds should be changed to reflect the full server path to the .htpasswds file (more on this later). If you do not know what the full path to your webspace is, check your HostITSmart cPanel. Look on the left &#8220;stats&#8221; column of the cPanel.<\/span><\/p>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">The .htpasswds File<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Password protecting a directory takes a little more work than any of the other .htaccess functions because you must also create a file to contain the usernames and passwords which are allowed to access the site. These should be placed in a file which (by default) should be called .htpasswd. This can be placed anywhere within you website (as the passwords are encrypted) but it is advisable to store it outside the web root (in your home directory) so that it is impossible to access it from the web.<\/span><\/p>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Entering Usernames And Passwords<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Once you have created your .htpasswd file (you can do this in a standard text editor) you must enter the usernames and passwords to access the site. They should be entered as follows:<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"font-size: small;\"><em><strong>username:password<\/strong><\/em><\/span><\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Where the password is the encrypted format of the password. There is a good username\/password service at the <a href=\"http:\/\/www.kxs.net\/support\/htaccess_pw.html\" target=\"_blank\" rel=\"noopener\"><span style=\"text-decoration: underline;\"><em><strong>KxS site<\/strong><\/em><\/span><\/a> which will allow you to enter the username and password and will output it in the correct format.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">For multiple users, just add extra lines to your .htpasswd file in the same format as the first.<\/span><\/p>\n<p><strong><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">Accessing The Site<\/span><\/strong><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">When you try to access a site which has been protected by .htaccess your browser will pop up a standard username\/password dialog box. Alternatively you can send the username and password (unencrypted) in the URL as follows:<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: medium;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"font-size: small;\"><em><strong>http:\/\/username:password@www.website.com\/directory\/<\/strong><\/em><\/span><\/span><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Windows: Using Notepad save the file as .htaccess Mac OS X: Using TextEdit save the file as &#8220;.htaccess&#8221; Note: If you save the file as .htaccess it will be hidden and you will not be able to see it in the Finder. Using your preferred FTP client upload the file to the server. The .htaccess [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":["post-103","post","type-post","status-publish","format-standard","hentry","category-hosting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>(dot) htaccess explained<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"(dot) htaccess explained\" \/>\n<meta property=\"og:description\" content=\"Windows: Using Notepad save the file as .htaccess Mac OS X: Using TextEdit save the file as &#8220;.htaccess&#8221; Note: If you save the file as .htaccess it will be hidden and you will not be able to see it in the Finder. Using your preferred FTP client upload the file to the server. The .htaccess [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html\" \/>\n<meta property=\"og:site_name\" content=\"Host IT Smart Knowledge base\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-06T08:39:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-09T06:37:14+00:00\" \/>\n<meta name=\"author\" content=\"Admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html#article\",\"isPartOf\":{\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html\"},\"author\":{\"name\":\"Admin\",\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/8b538056beea86b043adbd20df3a6ee9\"},\"headline\":\"(dot) htaccess explained\",\"datePublished\":\"2023-10-06T08:39:39+00:00\",\"dateModified\":\"2023-10-09T06:37:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html\"},\"wordCount\":1656,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#organization\"},\"articleSection\":[\"Hosting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html\",\"url\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html\",\"name\":\"(dot) htaccess explained\",\"isPartOf\":{\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#website\"},\"datePublished\":\"2023-10-06T08:39:39+00:00\",\"dateModified\":\"2023-10-09T06:37:14+00:00\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#website\",\"url\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/\",\"name\":\"Host IT Smart Knowledge base\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#organization\",\"name\":\"Host IT Smart Knowledge base\",\"url\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/logo\/image\/\",\"url\":\"\",\"contentUrl\":\"\",\"width\":240,\"height\":80,\"caption\":\"Host IT Smart Knowledge base\"},\"image\":{\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/8b538056beea86b043adbd20df3a6ee9\",\"name\":\"Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/17348df3a33347d3945161d87b752de1d7a7ec25dcbe15baacbd3b8a35367f66?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/17348df3a33347d3945161d87b752de1d7a7ec25dcbe15baacbd3b8a35367f66?s=96&d=mm&r=g\",\"caption\":\"Admin\"},\"sameAs\":[\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/\"],\"url\":\"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"(dot) htaccess explained","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html","og_locale":"en_US","og_type":"article","og_title":"(dot) htaccess explained","og_description":"Windows: Using Notepad save the file as .htaccess Mac OS X: Using TextEdit save the file as &#8220;.htaccess&#8221; Note: If you save the file as .htaccess it will be hidden and you will not be able to see it in the Finder. Using your preferred FTP client upload the file to the server. The .htaccess [&hellip;]","og_url":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html","og_site_name":"Host IT Smart Knowledge base","article_published_time":"2023-10-06T08:39:39+00:00","article_modified_time":"2023-10-09T06:37:14+00:00","author":"Admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Admin","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html#article","isPartOf":{"@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html"},"author":{"name":"Admin","@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/8b538056beea86b043adbd20df3a6ee9"},"headline":"(dot) htaccess explained","datePublished":"2023-10-06T08:39:39+00:00","dateModified":"2023-10-09T06:37:14+00:00","mainEntityOfPage":{"@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html"},"wordCount":1656,"commentCount":0,"publisher":{"@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#organization"},"articleSection":["Hosting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html","url":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html","name":"(dot) htaccess explained","isPartOf":{"@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#website"},"datePublished":"2023-10-06T08:39:39+00:00","dateModified":"2023-10-09T06:37:14+00:00","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/103\/dot-htaccess-explained.html"]}]},{"@type":"WebSite","@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#website","url":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/","name":"Host IT Smart Knowledge base","description":"","publisher":{"@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#organization","name":"Host IT Smart Knowledge base","url":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/logo\/image\/","url":"","contentUrl":"","width":240,"height":80,"caption":"Host IT Smart Knowledge base"},"image":{"@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/8b538056beea86b043adbd20df3a6ee9","name":"Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/17348df3a33347d3945161d87b752de1d7a7ec25dcbe15baacbd3b8a35367f66?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/17348df3a33347d3945161d87b752de1d7a7ec25dcbe15baacbd3b8a35367f66?s=96&d=mm&r=g","caption":"Admin"},"sameAs":["https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/"],"url":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts\/103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/comments?post=103"}],"version-history":[{"count":1,"href":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts\/103\/revisions"}],"predecessor-version":[{"id":407,"href":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts\/103\/revisions\/407"}],"wp:attachment":[{"href":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/media?parent=103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/categories?post=103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/new.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/tags?post=103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}