Welcome Guest, Not a member yet? Register   Sign In
How to remove public/index.php/ from url
#11

(This post was last modified: 10-04-2019, 06:32 PM by Poetawd.)

Hello Guys !

I ran into this problem too. My point is that I´m running my website on a SHARED HOSTING and I don´t want to mess around...

I just solved this by adding a .htaccess file in root directory:

Code:
DirectoryIndex /public/index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./public/index.php/$1 [L,QSA]
Reply
#12

(This post was last modified: 10-09-2019, 05:14 AM by wdeda.)

It's very simple:

- keep the original .htaccess from the public folder

- copy .htacccess and index.php from public folder to the root of your project;

- edit the index.php and change the line below...

$pathsPath = FCPATH . '../app/Config/Paths.php';

to...

$pathsPath = FCPATH . 'app/Config/Paths.php';

That's it!
Reply
#13

(This post was last modified: 10-16-2019, 07:32 PM by Chivinsdev.)

Based on your issue. I had the same problem look. I created two .htaccess file one at the public folder and the other at the root directory but no success so.
This is how I solved my own problem =>
I move the default .htaccess and the index.php files in the public directory to the root directory then I edit the index file to point to the app directory just like the code below
PHP Code:
// Location of the Paths config file.
// This is the line that might need to be changed, depending on your folder structure.
$pathsPath FCPATH '../app/Config/Paths.php';
// ^^^ Change this if you move your application folder 
to this below
PHP Code:
// Location of the Paths config file.
// This is the line that might need to be changed, depending on your folder structure.
$pathsPath FCPATH './app/Config/Paths.php';
// ^^^ Change this if you move your application folder 
I hope this will help you and others who are also facing the same issue
Reply
#14

(01-22-2018, 12:38 AM)ciadmin Wrote: https://bcit-ci.github.io/CodeIgniter4/g...x-php-file

If xxx/controller doesn't work, but xxx/index.php/controller does, then your htaccess is not working. Could be rewrite_module not loaded, or wrong permissions.
If xxx/controller doesn't work, but xxx/public/controller does, then your document root is set incorrectly inside apache.

If you have to resort to xxx/public/anything, then your document root is set incorrectly!
Hi, where do you set the document root?
Thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB