Custom php script as handler no longer works in .htaccess

software development

#1

Hi all,

I’m running into some issue setting up .htaccess for my website and i was hoping one of you can spot what i am doing wrong.

essentially, i’ve been trying to create my own authentication system by defining a custom handler script and forcing all html requests to be processed by the handler. the handler would have authentication/authorization logic that would then either allow the user to access the content or forward the user to appropriate error pages.

here’s my .htaccess:

AddHandler mylogin .html
Action mylogin /secure/access_handler.php

and the access_handler.php:

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.espn.com");
exit();
?>

note that the logic inside access_handler.php has been simplified for debugging.

anyway, when i first tried this 2 years ago, dreamhost would process my php logic correctly and “header” calls in the script would end up causing a forward to take place. but now, adding this new handler merely causes my php processing to take place on my html files. that is, instead of executing my “header” calls, php blocks inside my html files are now processed by the php handler somehow.

i’m kind of at a lost here. is this related to the secure setting that dreamhost provide for hosting? i am using php 5.2 version as supported by dreamhost.

would appreciate any help/thoughts. thanks!

-Wei