I am using nginx as my web server and have posted some links to it on Facebook. I have just changed my link from example.com to example.com/en/. Consequently, all the previous links will be unusable in Facebook, I would like to redirect all the example.com links to example.com/en.
My configuration:
server {
listen 80;
server_name example.com;
charset utf-8;
access_log logs/xxxxxx.access.log;
root /var/www/html;
index index.php;
location = / { return 301 /cn/; }
location / {
try_files $uri $uri/ /cn/index.php?q=$uri;
}
location /en {
try_files $uri $uri/ /en/index.php?q=$uri;
}
location /my {
try_files $uri $uri/ /my/index.php?q=$uri;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
0 Answers