Search code examples
.htaccess.htpasswd

is it possible to change URL of webpage using .htaccess and also want to protect folders using .htaccess?


I want to change Webpage URL http://www.xyz.com/in/index.php?mpid=page1 to http://www.xyz.com/in/page1 using .htaccess.

And also want to protect my folders with username and password.


Solution

  • AuthType Basic
    AuthName "Protected Area"
    #path to htpaswd
    AuthUserFile /path/to/.htpasswd
    Require valid-user
    
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^in
    RewriteRule /in/(.+) in/index.php?mpid=$1