07-20-2023, 03:45 PM
What you are looking for is the WEBROOT of your application based on your description. The checked answer is, by far, the closest answer.
The easiest way to identify the webroot is to have it be user defined, as was mentioned by Annika and noted in a comment.
However, there is a bit of information that was overlooked:
If you are trying to identify the location of the webroot, which coincidentally is also the top level of your framework, then you could use something like this:
```php
$web_only_path = dirname($_SERVER['PHP_SELF']);
```
This will only work if your rewrite conditions are implemented correctly.
If they are in an **htaccess** file, no sweat.
However, if they are in an apache conf file. Then they **must** be contained within a <Directory /path/label/> </Directory> container for the SERVER variable to store and return the proper information after working through the redirects when dealing with the SEO friendly URLs.
See:[SCRIPT_NAME and PHP_SELF with mod_rewrite in .conf](
The easiest way to identify the webroot is to have it be user defined, as was mentioned by Annika and noted in a comment.
However, there is a bit of information that was overlooked:
If you are trying to identify the location of the webroot, which coincidentally is also the top level of your framework, then you could use something like this:
```php
$web_only_path = dirname($_SERVER['PHP_SELF']);
```
This will only work if your rewrite conditions are implemented correctly.
If they are in an **htaccess** file, no sweat.
However, if they are in an apache conf file. Then they **must** be contained within a <Directory /path/label/> </Directory> container for the SERVER variable to store and return the proper information after working through the redirects when dealing with the SEO friendly URLs.
See:[SCRIPT_NAME and PHP_SELF with mod_rewrite in .conf](
[To see links please register here]
)