Welcome Guest, Not a member yet? Register   Sign In
Removing index.php not working on hosting althougt all conditions true
#1

(This post was last modified: 09-18-2019, 01:13 PM by futureisnow.)

Hi, 
first of all I know that is a famous problem and I have already tried probably everything and I am just tired after 4 days of fighting. I feel stupid asking that as the next but I am really desperate.

The thing is: 
Removing index.php from URL works fine on localhost (XAMMP) but does not work on hosting (OVH, Apache) i.e. http://example.com/index.php/contact works fine while http://example.com/contact does NOT work.

On the server I set "root folder" into "public" folder and it seems working.

My application is:

  1. Manually installed CI4 RC1
  2. One dummy view added (contact.php) to test url + its routing 
  3. App.php: 
  • $baseURL = "http://example.com/" 
  • $indexPage = ''

The original .htaccess in "public" folder didn't work on the hosting.

A dummy .htaccess like:

Quote:RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 

...also does not work (neither in "public" nor in "/" folder).

I can see only a message "File not found." when I choose 


Important is that my hosting provider told me "rewrite_mod" work correct on the server.

Does anybody know what problem can be?

Should .htaccess be placed in "public" or in "/"?

Best Regards!
Reply
#2

It should be in public.

If you installed CodeIgniter in a subfolder, you will need to set RewriteBase appropriately.
Reply
#3

(09-18-2019, 01:36 PM)dave friend Wrote: It should be in public.

If you installed CodeIgniter in a subfolder, you will need to set RewriteBase appropriately.

I tried to manipulate with it, but received only "500 Internal Server Error".

Well, it is preconfigored by hosting multipage version, so the app is in a subfolder in fact. But since it is preconfigured on the server I don't think it is a problem.
Reply
#4

Hey I found I solution I hope it will work for you.

create new file on root index.php and add below code :

<?php include "public/index.php"; ?>

now copy your .htaccess file from public and put it on root and thats all
it worked for me.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB