0

I have problems with htaccess on my project, when I use htaccess on the locale it runs fine and there is no problem, but when I upload it to the server it does not work.

I want my index.php to disappear, my domain is sindangasih-server.com/receiving. receiving is the name of my project.

My htaccess is like this.

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

and my config configuration looks like this

$http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://';
$newurl = str_replace("index.php","", $_SERVER['SCRIPT_NAME']);
$config['base_url']    = "$http" . $_SERVER['SERVER_NAME'] . "" . $newurl;

$config['index_page'] = '';

$config['uri_protocol'] = 'REQUEST_URI';

When I open sindangasih-server.com/receiving out writing like this.

The requested URL /receiving/tiket/tampildatatiket was not found on this server.

Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85
Ifadak
  • 65
  • 11
  • Possible duplicate of [How to remove "index.php" in codeigniter's path](https://stackoverflow.com/questions/1445385/how-to-remove-index-php-in-codeigniters-path) – arnold_p Mar 21 '18 at 02:04
  • none of which I tried to succeed – Ifadak Mar 21 '18 at 02:20
  • Possible duplicate of [Force https://www. for Codeigniter in htaccess with mod\_rewrite](https://stackoverflow.com/questions/8503663/force-https-www-for-codeigniter-in-htaccess-with-mod-rewrite) – Abdulla Nilam Mar 21 '18 at 05:13

1 Answers1

1

Try using below config for the base_url :

$newurl = str_replace( basename( $_SERVER['SCRIPT_NAME'] ), "", $_SERVER['SCRIPT_NAME'] );
$config['base_url']    = "$http" . $_SERVER['HTTP_HOST'] . "" . $newurl;
Hasta Dhana
  • 4,699
  • 7
  • 17
  • 26