1

I am working on admin panel to add/edit/delete the posts. So far I had all php files in root directory but I would like to structure it and put admin's related files in other directory(root/adminFiles) and here comes the issue of accessing adminLogin's URL as I was accessing it by typing domain/adminLogin and after moving admin's related file to different directory I would have to type domain/adminFiles/adminLogin.

I was thinking about renaming adminLogin.php to index.php (I think this is how Wordpress solved it) but then I have more than one index.php and it may be confusing, please advice best solution

  • You can redirect every thing to a file named index.php, in index.php you can decide to which file or method this route belongs to.[Redirect all to index.php using htaccess](https://stackoverflow.com/questions/18406156/redirect-all-to-index-php-using-htaccess) – Debuqer Aug 08 '21 at 07:31
  • There are some cool php-routers out there . They will handle every thing you need. [bramus/router](https://github.com/bramus/router) or [simple-php-router](https://github.com/skipperbent/simple-php-router) – Debuqer Aug 08 '21 at 07:36
  • 1
    Thanks it's a good idea – Seweryn Woźniak Aug 09 '21 at 17:59

0 Answers0