• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error 404 when trying to reach a link

#1
Hello, i ve been uploading my site online.
I do have access to my home page, but the login link is sending me back a 404 error.
Everything was working fine on my local server, but i can't access my links online since. As i am not using routes.php, the link is as simple as this <a class="btn btn-outline-info" href="<?= base_url('Auth'); ?>">Login</a>.


Could you please help me.
David
Reply

#2
Try site_url() instead of base_url().
Don't use a firstcaps in url's. Despite the fact that controllers are in firstcaps, the request shouldn't be. So site_url('auth') should work. It will try to open the index function in the auth controller.
Reply

#3
(09-16-2019, 07:19 AM)Wouter60 Wrote: Try site_url() instead of base_url().
Don't use a firstcaps in url's. Despite the fact that controllers are in firstcaps, the request shouldn't be. So site_url('auth') should work. It will try to open the index function in the auth controller.
thank you.
I am going to try that this morning Smile
Reply

#4
(09-16-2019, 10:52 PM)davidevillers Wrote:
(09-16-2019, 07:19 AM)Wouter60 Wrote: Try site_url() instead of base_url().
Don't use a firstcaps in url's. Despite the fact that controllers are in firstcaps, the request shouldn't be. So site_url('auth') should work. It will try to open the index function in the auth controller.
thank you.
I am going to try that this morning Smile
unfortunatly site_url is not working either. Should i use route.php to make the things easier ?
Reply

#5
I ve actually found a solution on github

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

ErrorDocument 404 /index.php
</IfModule>

https://gist.github.com/keithmorris/3023560
Reply

#6
When you are on online servers you need an .htaccess file ( for lunux) or web.config( for windows ) etc.
Because you have to tell to the server which path is your main.
Reply

#7
@davidevillers: Based on your solution, you don't happen to use GoDaddy by any change? That's the only place I have found that you need to append ? after index.php to get urls working.
Reply

#8
@jreklund
nope i am using IONOS 1&1
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.