How to redirect to specific page if not logged in with .htaccess

前端 未结 5 843
没有蜡笔的小新
没有蜡笔的小新 2021-01-06 00:30

I am running apache2 and php5 in my windows PC.

I have protected my directory using .htaccess and.htpasswd. If login information is not set

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-06 00:46

    I had the same question and although this is an old thread, I ended up simply using the 401 error document to display a particular page if authentication failed...

    ErrorDocument 401 /not-logged-in.php
    

    This seemed to do the trick for me in a simple way.

提交回复
热议问题