Search code examples
phphttp-redirectpermissionsxampphttp-status-code-403

403 Forbidden - You don't have permission to access this resource


Users are redirected once they logged in

//redirected when logged in
$dir = 'C:\xampp\htdocs\mysite\parentfolder/'. $_SESSION['name'];
chdir($dir);

This displays the folders inside the $dir and generate their links

<?php 
    $dir_open = opendir('.');
    $currentdir = getcwd();
    echo $currentdir;


    while(false !== ($filename = readdir($dir_open))){
        if($filename != "." && $filename != ".."){
            $link = "<a href='/$dir/$filename'> $filename </a><br />";
            echo $link;
        }
        
    }
    closedir($dir_open);
    ?>

The links redirects to the right directories(displayed in the address bar) but shows this error

Forbidden. You don't have permission to access this resource.

All of the folders are empty. Any tips to fix this?


Solution

  • you must grant privileges for folder