How to Password Protect a Directory With .htaccess

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 พ.ย. 2024

ความคิดเห็น • 52

  • @MystalurDimensh
    @MystalurDimensh 4 ปีที่แล้ว +2

    Finally a video that explains it properly! Thank you!

  • @RankYa
    @RankYa  9 ปีที่แล้ว +8

    Simply open that .txt file, and then "File >Save As" and then find "Save As Type" option and select "All files (*.*)" because then you will be able to save it as .xyz

  • @sanchitaggarwal6522
    @sanchitaggarwal6522 7 ปีที่แล้ว +1

    This video is soo helpfull. I like the way explain . you are soo good . I really appriciate.
    Thank. you for sharing

  • @nomdplume6166
    @nomdplume6166 7 ปีที่แล้ว +3

    Really useful video! Thanks a bunch for sharing!

  • @xdebono7613
    @xdebono7613 7 ปีที่แล้ว +2

    Well done.....very easy to follow

  • @georgeriley4839
    @georgeriley4839 3 ปีที่แล้ว

    That worked brilliantly thank you.

  • @dand5102
    @dand5102 7 ปีที่แล้ว +2

    Very useful. Thank You!

  • @WishowMetal
    @WishowMetal 7 ปีที่แล้ว

    Please, help!
    It is not working for me.
    I have another necessary rules in the .htaccess file that is located into the folder I want to protect (for https redirection). Since I added the validation rules, the folder can't be reached, I just see a NOT FOUND ERROR PAGE of my main domain, which is a WordPress site.
    What am I doing wrong?

    • @WishowMetal
      @WishowMetal 7 ปีที่แล้ว

      I've even done the process via cPanel assistant, but no results.

    • @RankYa
      @RankYa  7 ปีที่แล้ว

      I am not sure, because https redirection shouldn't make any difference from my understanding (or perhaps it may I am not sure for your setup). Anyhow, I think you got it fixed now? If so, please do share *how* you managed to do that. Thanks for sharing your input and yes if the #WordPress is installed in a sub-directory, your blog post information has that / forward slash (as you know represents another level of directory)

    • @WishowMetal
      @WishowMetal 7 ปีที่แล้ว

      Yeah, I fixed it by following these steps: www.nivindel.com/htaccess-password-protection-subdirectory-wont-work-wordpress/. It's due to the Permalinks structure of WP. Then, it's necessary to modify the htaccess file generated by WP too. Thanks for your reply!

    • @RankYa
      @RankYa  7 ปีที่แล้ว +1

      Great to hear, as for others reading this, make sure you backup .htacces file before experimenting, to learn more about .htaccess directives visit: codex.wordpress.org/htaccess

  • @RetoxMedia
    @RetoxMedia 6 ปีที่แล้ว +2

    Brilliant tutorial

  • @gagatvshare
    @gagatvshare 6 ปีที่แล้ว

    Hi, i done all the process properly. It works upto 10 days only. Know, it is not working. When i enter the user id and password. It shows the same login request only. how to solve it.

    • @RankYa
      @RankYa  6 ปีที่แล้ว

      Sorry Ganesh but I don't know why this would be, as in work for 10 days and now doesn't work. I would really appreciate you comment back when you work out the cause and solution to this

  • @jasmeetsingh9804
    @jasmeetsingh9804 4 ปีที่แล้ว

    how can we restrict particular URL in the website rather than folder.

    • @RankYa
      @RankYa  4 ปีที่แล้ว

      Hello Jasmeet, check this URL out which may help stackoverflow.com/questions/14603568/password-protect-a-specific-url if you find a solution please come back and comment on #RankYa TH-cam channel so that other coders can also benefit

  • @carloautor
    @carloautor 5 ปีที่แล้ว

    Hi. Just wanna ask, is there a way that I can terminate the session once they close the tab or the webpage? Thank you

    • @RankYa
      @RankYa  5 ปีที่แล้ว

      Hello Carlo, with PHP much is possible. Could be complex to achieve dependent on your skill level. But I think these will help stackoverflow.com/questions/24402047/php-session-destroy-after-closing-browser th-cam.com/video/JKHuhvBBhBQ/w-d-xo.html

  • @calin8817
    @calin8817 7 ปีที่แล้ว +2

    You save my day.
    Tks

  • @karunasagar3465
    @karunasagar3465 9 ปีที่แล้ว +1

    That very good tutorial i am very thank full to you its help me lot

  • @petermax4593
    @petermax4593 7 ปีที่แล้ว

    the authentication is not req. again in same browser chrome this is not req. for pass when i refresh the page

  • @puluqemil
    @puluqemil 9 ปีที่แล้ว +2

    very useful, thank you.

  • @muruligowda2985
    @muruligowda2985 7 ปีที่แล้ว

    Sir I Want Same Authentication But Using Login.php and style.css Page. And Giving Right username and password it's true then it redirect the welcome.php page...Please tel me how to do.

    • @RankYa
      @RankYa  7 ปีที่แล้ว

      I would presume that your private folder would have index.php (thus your login.php content placed in it) which you can style.css it as well. as for redirection I am not sure but this may help stackoverflow.com/questions/20506931/apache-htaccess-redirect-based-on-logged-in-user
      For php redirection this can work:

  • @lasansudeera6016
    @lasansudeera6016 6 ปีที่แล้ว +1

    Thank you very much!

  • @venustheplanet8208
    @venustheplanet8208 4 ปีที่แล้ว

    Tarek and Haya thank you.
    Vincent too.

  • @malachi5813
    @malachi5813 7 ปีที่แล้ว +2

    well done sir!

  • @2667cooper
    @2667cooper 9 ปีที่แล้ว +1

    my ".htmyxyz" file is automatically saving as a .txt file... how do I fix?

    • @TVPMLP
      @TVPMLP 7 ปีที่แล้ว

      save as all file type

  • @alexenache2910
    @alexenache2910 7 ปีที่แล้ว +1

    a very "OK!" video :) thank you

  • @VladimirOnOccasion
    @VladimirOnOccasion 4 ปีที่แล้ว +1

    nice video

  • @dibraniuk
    @dibraniuk 7 ปีที่แล้ว

    are you using file manager? where to download that from ? thx

    • @RankYa
      @RankYa  7 ปีที่แล้ว

      I use FileZilla FTP program, however, you can easily login to your web hosting > File Manager (and do everything there)

  • @greengrass1970
    @greengrass1970 8 ปีที่แล้ว +1

    Thanks - you saved my day :-)

  • @rajeshmoravaneni6630
    @rajeshmoravaneni6630 3 ปีที่แล้ว

    Thank You.

  • @jsc8409
    @jsc8409 5 ปีที่แล้ว

    does it still open in explorer ?

  • @cherniyosser4797
    @cherniyosser4797 7 ปีที่แล้ว +1

    thank u so much :)

  • @876Abb
    @876Abb 6 ปีที่แล้ว

    Video tutorial is not for everyone...he made it so hard to follow as he beats about the bush

    • @RankYa
      @RankYa  6 ปีที่แล้ว

      You may find this of help as well www.htaccesstools.com/articles/password-protection/

    • @RankYa
      @RankYa  6 ปีที่แล้ว

      Or this for those who find the video tutorial for password protection using .htaccess overwhelming stackoverflow.com/questions/5229656/password-protecting-a-directory-and-all-of-its-subfolders-using-htaccess

  • @4TruthBeTrue
    @4TruthBeTrue 6 ปีที่แล้ว

    would this work on an Amazon S3 ?

    • @RankYa
      @RankYa  6 ปีที่แล้ว

      That's a good question, more than unlikely, however, there must be a way to protect folders/files regardless of server setup (let us know the outcome please)

  • @nazrulhanif6372
    @nazrulhanif6372 7 ปีที่แล้ว

    thanks a lot

  • @VarnexArts
    @VarnexArts 7 ปีที่แล้ว +1

    100th like. :D

  • @kaceyhowell6570
    @kaceyhowell6570 6 ปีที่แล้ว +1

    Not a good video for people hosting their own apache server on a Windows machine.

    • @RankYa
      @RankYa  6 ปีที่แล้ว

      Thanks for the comment Kacey, can you by any chance briefly outline the steps for local apache server? That would be great

    • @kaceyhowell6570
      @kaceyhowell6570 6 ปีที่แล้ว +1

      I was going to do that earlier todayMost of it is the same, except for the file structure
      1: Add:
      *
      AllowOverride AuthConfig
      *
      To your httpd.conf file and restart your apache service
      2: Create an *.htpasswd* file and put it in the directory you want to protect and add this to the file:
      *AuthType Basic
      AuthName "Please Enter the Password to access this page"
      AuthUserFile C:Path/To/Your/Directory/You/Want/To/Protect/.htpasswd
      require valid-user*
      3. Use an *htpasswd* generator to create a username:password combo, I used this one www.web2generators.com/apache-tools/htpasswd-generator
      4. paste that into a .htaccess file that you create and put that in to the protected directory as well.
      That is about it. Like I said. Mostly the same, just the filesystem differences makes it hard to follow the video for a Windows user hosting an apache server. That is all I did to make mine work. hope that helps someone.

    • @RankYa
      @RankYa  6 ปีที่แล้ว

      Thanks Kasey for this great information, you are the best