Website URL
(http://smarte.infinityfreeapp.com/ )
Error Message
(404 NOT FOUND)
Other Information
(Website is only routing the first page with path " / " i have included a .htaccess file in my htdocs with the following commands:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [L]
But it still not working )
Working
try clearing cache of CTRL+F5
5 Likes
That the only directory working " / " try “/login” and see the results
Can you share the file at /login/index.[php/html] or the htaccess file that manages a redirection?
1 Like
It says new users can not upload attachments i pasted the code below
This code is working on localhost
.htaccess code
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php [L,QSA]
index.php code
<?php
$uri = parse_url($_SERVER["REQUEST_URI"])['path'];
$method = $_SERVER["REQUEST_METHOD"];
$GETroutes = [
'/' => 'login.php',
'/login' => 'login.php',
'/logout' => 'Views/logout.inc.php',
'/register' => 'register.php',
'/Dashboard' => 'Views/userdash_view.inc.php',
'/Profile' => 'Views/profile_view.inc.php',
'/Recharge' => 'Views/recharge_view.inc.php',
'/Contact' => 'Views/enquiry_view.inc.php',
'/FAQ' => 'Views/faq_view.inc.php',
'/api/voucher' => 'api/meter.php'
];
$POSTroutes = [
'/api/meter' => 'api/meters.php'
];
function route($uri, $routes){
if (array_key_exists($uri, $routes)){
require $routes[$uri];
}else{
require 'Views/404.php';
die();
}
}
if($method==='GET'){
route($uri, $GETroutes);
exit;
}else if($method==='POST'){
route($uri, $POSTroutes);
exit;
}
require 'Views/404.php';
die();
Admin
May 8, 2024, 8:58am
7
The .htaccess code you shared looks like it should do what you want it to do.
But when I check your site, I see:
A file called htaccess, not .htaccess, so any rules it in are not loaded.
It contains entirely different code from what you shared here.
Can you please restore the .htaccess code you shared here? Because I see no reason why it shouldn’t work if installed correctly.
5 Likes
Thank you admin you just saved my Degree because of a minor mistake.
system
Closed
May 15, 2024, 11:22am
9
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.