我们在nginx服务器上运行了一个旧版本的Magento(1.4)。我们在网站上有一些临时重定向(302's),需要转换为永久301重定向..在1.4中无法通过管理员面板执行此操作:(
任何人都可以为我提供nginx配置指令吗?
这是我的域配置文件:
rewrite ^/minify/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last;
rewrite ^/skin/m/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
expires 30d; ## Assume all files are cachable
}
location /app/ { deny all; }
location /includes/ { deny all; }
location /lib/ { deny all; }
location /media/downloadable/ { deny all; }
location /pkginfo/ { deny all; }
location /report/config.xml { deny all; }
location /var/ { deny all; }
location /lib/minify/ {
allow all;
}
location /var/export/ { ## Allow admins only to view export folder
auth_basic "Restricted"; ## Message shown in login window
auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
autoindex on;
}
location /. { ## Disable .htaccess and other hidden files
return 404;
}
location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}
location ~* ^(.+\.php)(.*) {
if (!-e $request_filename) { rewrite ^(.*)$ /index.php break; }
## Catch 404s that try_files miss
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param HTTPS $fastcgi_https;
#fastcgi_param MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
#fastcgi_param MAGE_RUN_TYPE store;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/luxuryleathergoods.com/public_html$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include fastcgi_params;
}
}
答案 0 :(得分:0)
对于每个重定向,您可以在location /
块(第一个)内的nginx配置中添加以下行:
rewrite /old/url.html /new/url.html