When I invoke http://localhost/myapp , this is displaying the login screen (index.php) and after accepting and validating the credentials, throws a 404 Page Not found error. When I debugged, it goes into the "if" statement but fails to load the page. dashboard.php
is available under views folder.
index.php
//validation section
if($usr2)
{
header('location: http://localhost/myapp/application/views/dashboard');
//redirect("http://$_SERVER[HTTP_HOST]/myapp/application/views/dashboard");
}
.htaccess (in the htdocs folder)
RewriteEngine on
RewriteBase /myapp/
RewriteRule ^(.*)$ -
#RewriteCond $1 !^(index\.php)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1
# browser requests PHP
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php
RewriteRule ^/?(.*)\.php$ /$1 [L,R=301]
# check to see if the request is for a PHP file:
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^/?(.*)$ /$1.php [L]
A bit late to answer, but capitalize "Location" and add the extension to your path:
header('Location: http://localhost/myapp/application/views/dashboard.php');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.