I'm moving from subdomain to subfolder.
I have multiple subfolders for several countries. I changed the domain in the Magento administration. But the Nginx rewrite doesn't seem to work. I have 1 Magento installation on my server and want to use /uk and /us.
The page is loading but all pages are giving me a 404 error.
I've been spending many hours on Google but can't find a working configuration. Hope someone can give a clue.
This is my config:
server {
listen 443 ssl http2;
root /home/domain_com/public_html/;
server_name www.domain.com/uk;
if ($http_host = cache.domain.com) {
rewrite (.*) https://www.domain.com$1 permanent;
}
if ($http_host = uk.domain.com) {
rewrite (.*) https://www.domain.com/uk$1 permanent;
}
location / {
index index.html index.php;
try_files $uri $uri/ @handler;
expires 30d;
}
location /downloader/ {
allow xx.xx.xx.xx;
deny all;
}
location ~ ^/(app|includes|lib|media/downloadable|pkginfo|report/config.xml|var)/ { internal; }
location /var/export/ { internal; }
location /. { return 404; }
location @handler { rewrite / /index.php; }
location ~* .php/ { rewrite ^(.*.php)/ $1 last; }
location ~* .php$ {
if (!-e $request_filename) { rewrite / /index.php last; }
expires off;
fastcgi_pass domain;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_param MAGE_RUN_CODE ic_uk;
fastcgi_param MAGE_RUN_TYPE website;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_read_timeout 60;
include /etc/nginx/fastcgi_params;
}
}