fixed public dir problems and handle routes using regex