LAN not maintaining server address in links YII2 advanced

Everything works fine on localhost but when I connect from remote computer to the server 192.168.200.152/paie.loc I get the home page fine as well as the login but when I push a button for a link

Paiment »

the remote navigator goes to paie.loc/index.php?r=partielle%2Findex" and not 192.168.200.152/paie.loc/index.php?r=partielle%2Findex"
I’ve been trying everything I can find on apache2 and YII2 but I’m to the point now I’d probably look square at the error and not see it.
As a temp I can add 192.168.200.152 paie.loc to the remote host file but that’s not a good solution in the end as many computers will eventually connect.

Could you post some code?
Is it a advanced app? or a basic?

Your Yii Config ?
The Template, where the domain appears?

Advanced
paie.loc.conf (current iteration, tried several)
<VirtualHost *:80>
ServerName paie.loc
DocumentRoot “/var/www/html/payroll/frontend/web/”

    <Directory "/var/www/html/payroll/frontend/web/">
			Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Require all granted
</Directory>


</VirtualHost>

main.php<?php
$params = array_merge(
require DIR . ‘/…/…/common/config/params.php’,
require DIR . ‘/…/…/common/config/params-local.php’,
require DIR . ‘/params.php’,
require DIR . ‘/params-local.php’
);

return [
‘id’ => ‘app-frontend’,
‘name’=>‘Paie Kasaï Central’,
‘basePath’ => dirname(DIR),
‘bootstrap’ => [‘log’],
‘controllerNamespace’ => ‘frontend\controllers’,
‘language’ => ‘fr-FR’,
‘timezone’ => ‘Africa/Harare’,
‘modules’ => [
‘gridview’ => [
‘class’ => ‘kartik\grid\Module’,
],
‘dynagrid’=>[
‘class’=>’\kartik\dynagrid\Module’,
// other settings (refer documentation)
],
],
‘components’ => [
‘request’ => [
‘csrfParam’ => ‘_csrf-frontend’,
],
‘user’ => [
‘identityClass’ => ‘common\models\User’,
‘enableAutoLogin’ => false,
‘identityCookie’ => [‘name’ => ‘_identity-frontend’, ‘httpOnly’ => true],
],
‘session’ => [
// this is the name of the session cookie used for login on the frontend
‘name’ => ‘advanced-frontend’,
],
‘log’ => [
‘traceLevel’ => YII_DEBUG ? 3 : 0,
‘targets’ => [
[
‘class’ => ‘yii\log\FileTarget’,
‘levels’ => [‘error’, ‘warning’],
],
],
],
‘authManager’=>
[
‘class’=> ‘yii\rbac\DbManager’,
‘defaultRoles’=> [‘guest’],
],
‘errorHandler’ => [
‘errorAction’ => ‘site/error’,
],

  /*  'urlManager' => [
        'enablePrettyUrl' => true,
        'showScriptName' => false,
        'rules' => [
        ],
    ],
    */

],
'params' => $params,

];

Thanks for the info, now i understand your problem.

Depends on your Operating System :

Windows < 8 :

C:\windows\hosts

Windows 8 and 10 :

C:windows\System32\drivers\etc\hosts 

Linux:

/etc/hosts

Please apply the following :

192.168.200.152   paie.loc

The Problem is you could only use an ip or a domain, but not a mix of it.
Otherwise you have to make some rewrite rules that 192.168.200.152/paie.loc rewrite to 192.168.200.152

Just to be clear I put that on the server side?
192.168.200.152 paie.loc

If I put that on the remote computer it works, I suppose that I could change all the links to include 192.168.200.152 but I would hope there’s a better way that allows for the software to be used on other servers and not need mods to remote computers.

The power of sharing to clear your head. What is not visible in the code above is that my links started with http://
Removed that and bingo all is well.

so you have hardcoded links in your code.
Prevent this in the future with relative links like

/user/index

e.g.

But nice to hear, that you fixed it. :slight_smile: