CodeIgniter Forums
Error 404 when trying to reach a link - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forum-9.html)
+--- Thread: Error 404 when trying to reach a link (/thread-74364.html)

Pages: 1 2


Error 404 when trying to reach a link - davidevillers - 09-16-2019

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


RE: Error 404 when trying to reach a link - Wouter60 - 09-16-2019

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.


RE: Error 404 when trying to reach a link - davidevillers - 09-16-2019

(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


RE: Error 404 when trying to reach a link - davidevillers - 09-17-2019

(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 ?


RE: Error 404 when trying to reach a link - davidevillers - 09-17-2019

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


RE: Error 404 when trying to reach a link - mboufos - 09-17-2019

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.


RE: Error 404 when trying to reach a link - jreklund - 09-17-2019

@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.


RE: Error 404 when trying to reach a link - davidevillers - 09-20-2019

@jreklund
nope i am using IONOS 1&1


RE: Error 404 when trying to reach a link - jeffkdanies - 12-07-2019

The HTTP error 404, or more commonly called "404 error", means that the page you are trying to open could not be found on the server. This is a client-side incident which means either the page has been deleted or moved, and the URL has not been modified accordingly, or that you have misspelled the URL. Try out the blue light filter for pc on this website.


RE: Error 404 when trying to reach a link - Sujata - 02-13-2020

(09-17-2019, 02:08 AM)mboufos Wrote: 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.
Hi,
Could you please mention the changes required. I am also facing the same issue.
TIA.