简体   繁体   中英

Change base URL in CodeIgniter

The website was build with CodeIgniter. This is accessible by typing https://test.mysite.eu .

I tried to change the base URL to remove the ' test ', I found this documentation and changed the following config file application/config/config.php

I changed this

$config['base_url'] = 'https://test.mysite.eu/';

to

$config['base_url'] = 'https://mysite.eu/';

And then, everything failed. The website is not accessible anymore.

When I try to access to https://test.mysite.eu/ , this redirect me to https://mysite.eu/ but the browser display this error message : Address not found.

Should I change something more? Clear a cache? I am pretty new to CodeIgniter so sorry for my lack of competence.

The .htaccess

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /       
    RewriteCond $1 !^(themes)   
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond $1 !^(index\.php|assets|static|img|css|js|map|favicon\.ico)
    RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
    RewriteRule ^sitemap\.xml$ ./index.php?/$1 [L,QSA]
    RewriteRule ^robots\.txt$ ./index.php?/$1 [L,QSA]       
</IfModule>

<IfModule mod_deflate.c>
    <filesMatch "\.(js|css|png)$">
        SetOutputFilter DEFLATE
    </filesMatch>
</IfModule>

AddOutputFilterByType DEFLATE text/ico text/html text/plain text/xml text/css application/javascript application/x-javascript application/x-httpd-php application/rss+xml application/atom_xml text/javascript

add this code in .htaccess file.

  RewriteCond %{HTTP_HOST} ^test\.mysite\.eu
  RewriteRule ^/?$ "http\:\/\/mysite\.eu\/" [R=301,L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM