Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Problem with .htaccess


testmuch's Avatar
Member
0 0

Hello everyone

Im having some troubles with setting up htaccess… i tried it on my own "virtual server" (wamp) and i also tried it on a hosted website at work, i got the same error so i must be doing something wrong..

heres the code of my .htacces file: AuthUserFile Images/.htpasswd AuthGroupFile /dev/null AuthName /Images AuthType Basic

<Limit GET POST> require valid-user </Limit>

and heres the .htpasswd file

boka:XkdilJR2Or4JU

i used this http://aspirine.org/htpasswd_en.html

i have them both files in the "Images" which is in my "www" directory

the login windows pops up but when i try i get a "500 internal server error"

any word on what im doing wrong here? :D


Mordak's Avatar
Evil Sorcerer
4,025 19

Which version of apache are you using ?


lolly's Avatar
Member
0 0

you're running wamp (windows) and you have the group file pointing to /dev/null?


elmiguel's Avatar
Member
2,795 1

Well it depends on how your web page is marked up and or coded. For instance a 500 internal error is very generic and doesn't fully explain the error. Are you trying to render the page in php, asp(x), jsp(x), etc.?

If you are using a server side programming language such as those mentioned above and you have a syntax error, this will occur. For example,

[php] <?php //….. function renderIMG($path, $alt){ /** $path = santized path from within class.. ** $alt = sanitized alt text from within class **/
return "<img src='$path' alt='$alt'>"; }//notice below }//</==== Syntax error

echo renderIMG(&#39;./imgs/image1.png&#39;, &#39;Image One&#39;);
//.....

?> [/php]

Now, either php will try to throw an fatal error, or Apache will try to handle it first from your .htaccess file. If handling from your .htaccess, this will generate a 500 internal server error. Meaning it tried to render but an error has occurred.

You could also have a typo in the .htaccess file itself, sometimes when copying and pasting you can pick up non-rendering characters and then depending on what encoding you save it as compared to what the it should be, this could cause errors as well.

This is just one instance of this error as I had this happen to me yesterday when I accidentally added an extra } at the end of my class.


elmiguel's Avatar
Member
2,795 1

Another thing came to mind, depending on how your displaying your Content-Type in your header could confuse your .htaccess file.

[php] <?php header("Content-type: application/json; charset=utf-8");</== could cause an error if page fails include_once('./database_config.php'); include_once('./VideoPortal.php');
$video_portal = new VideoPortal($host, $database, $user, $pass); //create our sql var with a preset to search from… $sql = $video_portal->getQuery("SELECT TOP(100) PERCENT ");

//echo $sql; if (isset($_GET) && !empty($_GET)){ //Get all the get variables into an array $getVars = $_GET;
//builds the query if the params are met and are not empty or null $sql .= $video_portal->buildQuery($getVars); //echo "$sql\n"; //commit the query and print the json object echo $video_portal->testQuery3($sql);
} else { //search terms are non existent -> create default search… $sql = $video_portal->getQuery("SELECT TOP 50 "); $sql.= " ORDER BY [video_dateCreated] desc;–"; echo $video_portal->testQuery3($sql); } //kill the connection after the process
$video_portal->killConn();
?>

[/php]