in this code
$uri = (substr($_SERVER['REQUEST_URI'],10));
what does 10 represent? Is it removing the domain from the url? if so, you may need to change it for your use case
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
HI!
I have still a problem with the document root I applied all the solution, also change my operating system, completely remove XAMPP and install Apache & MySQL locally this method not work for me and then I reinstall xampp then try to run the app but noting gets change.
Now the home page loaded but when I visited any link it shows me this error
`` Object not found! The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404 localhost Apache/2.4.37 (Unix) OpenSSL/1.0.2q PHP/7.1.26 mod_perl/2.0.8-dev Perl/v5.16.3 ``
here are those link in which I define my problem
https://laracasts.com/discuss/channels/requests/the-php-practitioner https://stackoverflow.com/questions/55365071/problem-with-redirect-to-other-pages-using-uri
@JLRDW - yes why not
I made a change in routes.php, htaccess & request.php files
In the start, I place the root directory routes.php
<?php
$router->get('re-test','controllers/index.php');
$router->get('re-test/about','controllers/about.php');
$router->get('re-test/about/culture','controllers/about-culture.php');
$router->get('re-test/contact','controllers/contact.php');
$router->get('names','controllers/add-name.php');
.htaccess
RewriteEngine On
RewriteBase /re-test/
AddType text/css .css
AddType text/javascript .js
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteRule ^.*$ index.php [END]
Request.php
trim($_SERVER['REQUEST_URI'], '/' );
Please or to participate in this conversation.