need help in editing htaccess file

Discussion in 'PHP' started by rajeeilan, Jan 30, 2008.

  1. #1
    hi all,

    i have to edit . htaccess file for my new server

    i tried with some htaccess generator but i can't find the problem
    help me
     
    rajeeilan, Jan 30, 2008 IP
  2. mvl

    mvl Peon

    Messages:
    147
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Just use a regular text editor.
     
    mvl, Jan 30, 2008 IP
  3. rajeeilan

    rajeeilan Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That's not problem

    how can i change authname and htpasswd
     
    rajeeilan, Jan 30, 2008 IP
  4. mvl

    mvl Peon

    Messages:
    147
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    mvl, Jan 30, 2008 IP
  5. seoyo

    seoyo Peon

    Messages:
    17
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You need to start by creating a new .htpasswd file for your site. You can do this by logging into your server over SSH (you may need to contact your web host to set this up).

    Once connected via shell, you'll change to the directory your site is in on the server and run a command similar to this one:

    htpasswd -c .htpasswd bobby

    You'll of course substitute your username where it says bobby above.

    Now you'll create a file called .htaccess with the following in it:

    AuthUserFile /path/to/my/site/.htpasswd
    AuthName "Title for Protected Site"
    AuthType Basic
    Require valid-user

    You'll replace /path/to/my/site with the actual path on your server to your site (you can see this by issuing the command pwd while in your site root). You'll also replace "Title for Protected Site" with the message you want to show up for your password protection.
     
    seoyo, Jan 30, 2008 IP