Welcome Guest, Not a member yet? Register   Sign In
problem slash at the end of url
#1

Hello,

I'm trying this url on my project:  http://localhost/ci4.0.4/about   
Result: works fine

but when I added slash at the end of the url like:
http://localhost/ci4.0.4/about/

Result: it redirect to http://localhost/about

This is my setup:
$baseURL = 'http://localhost/ci4.0.4/';

I'm using: wamp server under Windows10

any advice, Thanks in Advance,
Reply
#2

Can you change the folder name from ci4.0.4 to something else without the dots ?
Reply
#3

(12-11-2020, 01:38 AM)sammyskills Wrote: Can you change the folder name from ci4.0.4 to something else without the dots ?

I did, but still not working!!
Reply
#4

Okay.
Can you share what you have in your .htaccess file?
Reply
#5
Photo 
(This post was last modified: 12-11-2020, 11:19 AM by Halim.)

(12-11-2020, 11:05 AM)sammyskills Wrote: Okay.
Can you share what you have in your .htaccess file?

Sure, 
By the way, I moved the index.php and htaccess from public folder to the root

This is my htaccess and Routes files  (I attached my htaccess)


My Routes:

/**
* Auth routes
*/
$routes->match(['get', 'post'], 'login', 'Auth\LoginController', ['filter' => 'noauth']);
$routes->match(['get', 'post'], 'password/forgot', 'Auth\PasswordController::forgot', ['filter' => 'noauth']);
$routes->match(['get', 'post'], 'register', 'Auth\RegisterController', ['filter' => 'noauth']);
$routes->get('logout', 'Auth\LogoutController::index');

/**
* App routes
*/
$routes->get('/', 'HomeController::index', ['filter' => 'auth']);
$routes->get('/home', 'HomeController::index', ['filter' => 'auth']);
$routes->get('/about', 'AboutController::index', ['filter' => 'auth']);

Attached Files Thumbnail(s)
   
Reply
#6

Quote:By the way, I moved the index.php and htaccess from public folder to the root

Just to confirm... Have you updated the default $pathsPath = realpath(FCPATH . '../app/Config/Paths.php'); to match the current directory structure?
Reply
#7

(12-11-2020, 11:36 AM)sammyskills Wrote:
Quote:By the way, I moved the index.php and htaccess from public folder to the root

Just to confirm... Have you updated the default $pathsPath = realpath(FCPATH . '../app/Config/Paths.php'); to match the current directory structure?


Yes, I did otherwise it will not work

This is my pathsPath:

$pathsPath = realpath(FCPATH . 'app/Config/Paths.php');
Reply
#8

Okay.

I think the problem you're facing is related to the location of the index.php and .htaccess. From the docs, those files should be in your public folder.

I can't really say what you want to achieve by having those files outside of the public folder, maybe you can shed some light so I can understand better.
Reply
#9

(This post was last modified: 12-11-2020, 12:04 PM by Halim.)

(12-11-2020, 11:48 AM)sammyskills Wrote: Okay.

I think the problem you're facing is related to the location of the index.php and .htaccess. From the docs, those files should be in your public folder.

I can't really say what you want to achieve by having those files outside of the public folder, maybe you can shed some light so I can understand better.

Thank you for you reply,
I put the files outside of public because my goal is to host the application in a shared hosting, so I want to remove public folder from my url, and this is what most people suggest to do if you want to host the app in a shared hosting

I just tried it using the public folder and it has the same behavior!!
Reply
#10

You need to edit the Paths.php file and give it the correct path to system and app folders.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB