0

I have a question please... this is my project where I use CI 3x HMVC in Linux hosting I have an error:

.htaccess is this:

Options +FollowSymlinks
RewriteEngine on
RewriteBase /
Options -Indexes


### Redirigir la URL sin www a con www ### 
RewriteCond %{HTTP_HOST} ^myserver.com
RewriteRule (.*) https://www.myserver.com/$1 [R=301,L]

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^myserver.com [OR]
RewriteCond %{HTTP_HOST} ^www.myserver.com
RewriteRule (.*) https://www.myserver.com/$1 [R=301,L,QSA] #Falta www


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

RewriteCond $1 !^(index\.php|global|favicon\.ico|javascript)

In my file config.php I have this line:

$config['base_url'] = 'https://www.myserver.com/';

When I load https://www.myserver.com/ in the main "module" (front) I see in all my forms that all have this format:

<form action="https://www.myserver.com/controllerxxxx" action="post"....

The problem is when I load the https://www.myserver.com/admin module... I see in all my forms that have this format...

The difference is in "ADMIN" that my base_url is https://myserver.com/ Without WWW.

What is wrong? Can you help me please?

I need to solve this problem and keep my URL server with WWW in Front and Admin modules.

Thanks!

AbdulAhmad Matin
  • 1,047
  • 1
  • 18
  • 27
user1228739
  • 153
  • 3
  • 19

1 Answers1

1

use this instead of that. so replace your .htaccess code with this code.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

for change HTTP to HTTPS try this.

 RewriteEngine On
 RewriteCond %{HTTPS} !=on
 RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
AbdulAhmad Matin
  • 1,047
  • 1
  • 18
  • 27
  • This code gives me a lot of errors like this: https://www.myserver.com/listar-resumen-estados/1/1 404 (Not Found) and others errors like this... cross domain Ajax... etc – user1228739 Aug 27 '18 at 17:39
  • Thanks... but in my Admin/views forms I see this code:
    And I need http://www.myserver... I see my Base_url is the problem in Admin it changes to be myserver.com ... but in Front(main) module is www.myserver.com
    – user1228739 Aug 27 '18 at 18:05
  • I give you a screen shot to view my problem, Thanks! – user1228739 Aug 27 '18 at 18:16
  • Thanks!!! my dear friend! It was my error... I put in another config... myserver.com and "admin" was using this file...Sorry!!! You are so beautiful!!! (I have to delete this conflictive file) – user1228739 Aug 27 '18 at 18:25