-1

So i got this yii2 project, it works fine when i open the URL with http://localhost/myproject/index.php/login/index, but when i open http://localhost/myproject/config/, http://localhost/myproject/uploads/ and http://localhost/myproject/web/access it can access folder inside it.

how can i hide those folder or disable to access it by public?

here is the screenshot how it look like when i open those URL

enter image description here

i don't know why there is no htaccess in this project (i continue the project from the previous developer)

Alghany Jagad
  • 239
  • 5
  • 13
  • "i don't know why there is no htaccess" - Presumably you can create one, can you not? – MrWhite Jan 11 '22 at 09:52
  • it solved, but i don't know how, my devops solve it on server – Alghany Jagad Jan 11 '22 at 10:15
  • 1
    By default Yii2 project structure expects you to point the webroot to the `web` folder which contains `index.php`, `.htaccess` and other files and folders that should be accessible directly. That's probably how it's solved on your production server. – Michal Hynčica Jan 11 '22 at 10:24

1 Answers1

-2

at the root of the project add a file called index.php with a redirect to the web folder like this

<?php
header("location: web/");
?>

with this when entering the root you will be redirected to the web folder, which will load your project and you will not see the folder structure