私は2つのウェブサイトを持っています。ウェブサイトAとBを考えてみましょう。どちらもMagentoを使用しています。
Bのほとんどすべての製品はAにも組み込まれています。
ウェブサイトBは閉鎖されるため、一致するすべての商品がウェブサイトAにリダイレクトされます。他のページ(一致しない商品やその他のURL)については、Aのホームページにリダイレクトされます。
一致する製品をBからAにマップするスクリプトを作成しました(名前mapping.txtの下に置きます)。これには、約20000のURLが含まれています。
リダイレクトを行うために、私はnginx HttpMapModule(http://wiki.nginx.org/HttpMapModule)を使用しています
私はこのconfを使用してそれをマッピングすることができました:
map $uri $new{
default http://www.a.com/?ref=b;
include /some/path/mapping.txt;
}
server {
listen 80 ;
listen 443 ssl;
server_name www.b.com;
root /some/path/www/b;
#redirect b
rewrite ^ $new redirect;
location / {
index index.html index.php;
try_files $uri $uri/ @handler;
expires 30d;
}
.
.
.
}
問題は、Bの管理ページにアクセスできるようにしたいということです。デフォルトの地図のため、http://www.b.com/admin
もうアクセスできません。
次に、confを変更しました。
map $uri $new{
default http://www.a.com/?ref=b;
include /some/path/mapping.txt;
}
server {
listen 80 ;
listen 443 ssl;
server_name www.b.com;
root /some/path/www/b;
location / {
#redirect b
rewrite ^ $new redirect;
index index.html index.php;
try_files $uri $uri/ @handler;
expires 30d;
}
.
.
.
}
このconfによって、私はまだアクセスできませんが、アクセスhttp://www.b.com/admin
できますが、(およびにリダイレクトされる)へのhttp://www.b.com/index.php/admin
要求のためにcssとjsがロードされませんhttp://www.b.com/skin/.....
http://www.b.com/js/.....
http://www.a.com/?ref=b
しかし、このconfも問題があり、入力してもAのホームページにリダイレクトされませんhttp://www.b.com/index.php/customer/account/login
mapping.txtのコンテンツ例:
/product-abc.html http://www.a.com/product-abc12.html;
/category-a/product-xyz.html http://www.a.com/product-xyz.html;
/category-b/category-d/product-123.html http://www.a.com/category-e/product-12z.html;