2015-02-04 2 views
0

우리는 modx 사이트를 가지고 있으며 URL을 다시 쓰려고합니다. 하지만 매번 우리가 www.example.com/hello/x123처럼 다시 할 패턴 MODx URL nginx를 다시 작성

www.example.com/abc.html?arg1=x123 & ARG2 = 555L

처럼 가지고 실패 우리가

우리의 nginx 서버를 사용하고 있는지 어떻게 할 수 -555L

server { 
listen 80; 
server_name www.example.com example.com; 
root /var/www/test; 
index index.php index.html; 
location ~* .(jpg|jpeg|png|gif|ico|css|js|ttf)$ { 
expires 30d; 
add_header Pragma public; 
add_header Cache-Control "public"; 
} 

location ~ .(aspx|jsp|cgi)$ { 
return 410; 
} 

# exclude /favicon.ico from logs 
location = /favicon.ico { 
log_not_found off; 
access_log off; 
} 

if ($host = "example.com") { 
rewrite^$scheme://www.example.com$uri permanent; 
} 

location/{ 
root /var/www/test; 
try_files $uri $uri/ @rewrite; 
} 

location @rewrite { 
rewrite ^/(.*)$ /index.php?q=$1; 
} 

#www.example.com/abc.html?arg1=x123&arg2=555L => www.example.com/hello/x123-555L 
location = /abc-xyz.html { 
rewrite^/hello/$arg_arg1-$arg_arg2 last; 
} 

location ~ \.php$ { 
try_files $uri =404; 
fastcgi_split_path_info ^(.+\.php)(.*)$; 
fastcgi_pass 127.0.0.1:9000; 
fastcgi_index index.php; 
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
include fastcgi_params; 
fastcgi_ignore_client_abort on; 
fastcgi_param SERVER_NAME $http_host; 
} 

location ~ /\.ht { 
deny all; 
} 
} 
+0

, 명확하게 이해하지 못했다 브라우저에 표시 할이 두 개의 링크, 어떤 당신이 실제로 전달하려는 그 어떤 – SuddenHead

+0

를 백엔드 두 번째 URL은 예상 URL입니다. –

답변

0

죄송 아직도 당신이 다시 원하는 두, 그래서 여기에 두 경우 모두

을위한 솔루션을의 어떤 이해가 안 돼요

location = /abc.html { 
      rewrite^/hello/$arg_arg1-$arg_arg2 last; 
    } 

location ~ ^/hello/(\w+)-(\w+) { 
    rewrite^/abc.html?arg1=$1&$arg2=$2 last; 
} 
+0

예상 URL은 www.example.com/hello/x123-555L입니다. –

+0

아직도 작동하지 않습니다. 내 conf 파일을 추가했는데 거기에 어떤 문제가 있습니까? –