bramus / router

A lightweight and simple object oriented PHP Router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

help .php

nsultaan opened this issue · comments

hey
i set everything but i face problem

/home
but if user visit /home.php its also work

so my question is how to block access of .php file ??

sorry for bed english
and thank u for amazing router ❤️

You could try something like this (of course you need to put it where you find it convenient, like, in the beggining of the file):

  • index.php: define('IS_ROUTER_FILE', true);
  • home.php: if(!defined('IS_ROUTER_FILE')) exit();

You should place these files outside of your public folder that is served by the webserver. Ideally, this public folder only contains an index.php and a .htaccess (or equivalent)