- 取得連結
- X
- 以電子郵件傳送
- 其他應用程式
by Nginx server redirect all HTTP request to another site
example:
from http://www.def.com/test/?x=1&y=1
to http://www.abc.com/test/?x=1&y=1
from http://www.def.com/index.php/test/?x=1&y=1
to http://www.abc.com/test/?x=1&y=1
example:
from http://www.def.com/test/?x=1&y=1
to http://www.abc.com/test/?x=1&y=1
from http://www.def.com/index.php/test/?x=1&y=1
to http://www.abc.com/test/?x=1&y=1
server {
listen 1.1.1.1:80;
server_name .def.com;
set $root_path '/home/user/www/public';
root $root_path;
if ($request_uri ~* "^\/index\.php(.*)") {
return 301 http://www.abc.com$1; #remove index.php
}
return 301 http://www.abc.com$request_uri;
}
留言