2012-10-18 56 views
1

我們有一個運行在nginx服務器上的Magento(1.4)的老版本。我們在網站上有幾個臨時重定向(302),需要轉換爲永久301重定向。無法通過管理面板在1.4中執行此操作:(Magento 1.4 - nginx服務器| 302對永久301的?

任何人都可以爲我提供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

對於每一個重定向,你可以將下面的行添加到您的nginx的配置,location /塊內(第一) :

rewrite /old/url.html /new/url.html