开发者

Best way to password protect a site? .htacess

I created/edited a .htaccess file and I got my site password protect开发者_JS百科ed fine. Question though: Is there such thing as a URL key? Maybe I'm wording that incorrectly, but I would like to keep my site hidden, but be able to send out a specific URL that can view the site. What's the best way to accomplish this?

Thanks in advance.


If doing as Greg suggests and putting it in a folder isn't good enough for you, you could set the .htaccess to rewrite all url's to a php file (or whatever language you are using) and it checks some sort of database (or xml file or whatever format you want) for a key or parameter in the URL, and if its not there it can return a 404 in the header. That way unless they guess the url exactly it will return a 404 like there's nothing there.

And be sure to turn virtual directory listings off too.


Simply put your site in a directory that's using a "secret" name:

    http://example.com/opensesame/

If you don't link to that, then it will be "hidden" unless you give out the URL.

Naturally, this doesn't protect against other people publishing your "secret" URL and linking to your site anyway.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜