1

I am working on a project using PHP and routers. I have this error message.

Notice: Undefined index: BASE_URI in C:\laragon\www\myproject\public\index.php on line 30
Notice: Undefined index: BASE_URI in C:\laragon\www\myproject\app\Controllers\MainController.php on line 39

Here is line 39 :

    `$viewVars['baseURL'] = $_SERVER['BASE_URI'];`
I also have a .htaccess file :
RewriteEngine On

# dynamically setup base URI
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE_URI:%1]

# redirect every request to index.php
# and give the relative URL in "_url" GET param
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]

Where can I define my BASE_URI ? Thanks for your help !!

Rolek
  • 73
  • 6
  • Does this answer your question? ["Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" using PHP](https://stackoverflow.com/questions/4261133/notice-undefined-variable-notice-undefined-index-and-notice-undefined) – Nico Haase Sep 21 '21 at 08:20
  • Where is the `.htaccess` file located? What is the URL you are requesting? And what is the document root directory? – MrWhite Sep 21 '21 at 11:33

0 Answers0