{"id":41,"date":"2008-11-17T09:27:16","date_gmt":"2008-11-17T02:27:16","guid":{"rendered":"http:\/\/blog.binus-edu.com\/?p=41"},"modified":"2009-04-17T13:56:25","modified_gmt":"2009-04-17T06:56:25","slug":"how-to-add-htaccess","status":"publish","type":"post","link":"https:\/\/adityo.blog.binusian.org\/?p=41","title":{"rendered":"How to add .htaccess"},"content":{"rendered":"<p>&nbsp;<\/p>\n<h2>what is .htaccess ?<\/h2>\n<p>In several <a title=\"Web server\" href=\"http:\/\/en.wikipedia.org\/wiki\/Web_server\">web servers<\/a> (most commonly <a title=\"Apache HTTP Server\" href=\"http:\/\/en.wikipedia.org\/wiki\/Apache_HTTP_Server\">Apache<\/a>), <b>.htaccess<\/b> (<i><a title=\"Hypertext\" href=\"http:\/\/en.wikipedia.org\/wiki\/Hypertext\">hypertext<\/a> access<\/i>) is the default name of <a title=\"Directory (file systems)\" href=\"http:\/\/en.wikipedia.org\/wiki\/Directory_%28file_systems%29\">directory<\/a>-level <a title=\"Configuration file\" href=\"http:\/\/en.wikipedia.org\/wiki\/Configuration_file\">configuration files<\/a>. A .htaccess file is placed in a particular directory, and the directives in the .htaccess file apply to that directory, and all subdirectories thereof. It provides the ability to customize configuration for requests to the particular directory. The file name starts with a dot because <a class=\"mw-redirect\" title=\"Dot-file\" href=\"http:\/\/en.wikipedia.org\/wiki\/Dot-file\">dot-files<\/a> are by convention hidden files on <a title=\"Unix-like\" href=\"http:\/\/en.wikipedia.org\/wiki\/Unix-like\">Unix-like<\/a> operating systems. A subset of Apache&#8217;s .htaccess syntax is also supported by other web servers, such as <a title=\"Sun Java System Web Server\" href=\"http:\/\/en.wikipedia.org\/wiki\/Sun_Java_System_Web_Server\">Sun Java System Web Server<\/a> and <a title=\"Zeus Web Server\" href=\"http:\/\/en.wikipedia.org\/wiki\/Zeus_Web_Server\">Zeus Web Server<\/a>.<\/p>\n<p>Setup :<\/p>\n<ol>\n<li>Go to \/etc\/httpd\/conf\/httpd.conf and changes<br \/>\n    &#8211; Options Indexes Multiviews<br \/>\n    to<br \/>\n    &#8211; AllowOverride AuthConfig<br \/>\n    &nbsp;<\/li>\n<li>Restart the httpd service<\/li>\n<\/ol>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp; #service httpd restart<\/code><\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3. Create the .htacces usually on the public_html folder<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # vi .htaccess<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AuthType Basic<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AuthName &quot;Stoooop! Limited Access Choy!!!&quot;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AuthUserFile &quot;\/opt\/test.passwd&quot;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Require user adityo<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4. Create the user and password<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # \/usr\/bin\/htpasswd -c \/opt\/test.passwd adityo<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; New password:<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Re-Type new password:<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Adding password for user adityo<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 5. We can see the user and password on opt\/test.passwd or the directory you set the passwd<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #cat \/opt\/test.passwd<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; adityo:VdktHJc9rTipoU<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<\/code>&nbsp;<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6. how to add another user on .hatccess<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code> #\/usr\/bin\/htpasswd&nbsp; \/home\/blogbin\/test.passwd prie<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; New password:<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Re-type new password:<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Adding password for user prie<\/code><\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; You can see the user on opt\/test.passwd<\/p>\n<p><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #cat \/opt\/test.passwd<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; adityo:VdktHJc9rTipoU<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prie:9U6X9AsqI8\/02<\/code><br \/>\n&nbsp;<\/p>\n<p>&nbsp;&nbsp;&nbsp; now you can try to authenticate the .htaccess on your http:\/\/localhost \/ web address<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; what is .htaccess ? In several web servers (most commonly Apache), .htaccess (hypertext access) is the default name of directory-level configuration files. A .htaccess file is placed in a particular directory, and the directives in the .htaccess file apply to that directory, and all subdirectories thereof. It provides the ability to customize configuration for [&hellip;]<\/p>\n","protected":false},"author":386,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[487],"tags":[913],"class_list":["post-41","post","type-post","status-publish","format-standard","hentry","category-centos","tag-how-to-set-htaccess"],"_links":{"self":[{"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/posts\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/users\/386"}],"replies":[{"embeddable":true,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=41"}],"version-history":[{"count":2,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/posts\/41\/revisions"}],"predecessor-version":[{"id":308,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/posts\/41\/revisions\/308"}],"wp:attachment":[{"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}