1
Nginx와 일치하는 Apache 접두사를 변환하는 방법은 무엇입니까?재 작성 규칙 접두어를 Apache에서 Nginx로 변환
RewriteCond %{REQUEST_URI} ^/test1
RewriteRule ^(.*)$ http://newsite/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/foo
RewriteRule ^(.*)$ http://newsite/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/bar
RewriteRule ^(.*)$ http://newsite/$1 [R=301,L]
또는
RewriteRule ^/test1/(.*)$ http://newsite/test1/$1 [R=301,L]
RewriteRule ^/foo/(.*)$ http://newsite/foo/$1 [R=301,L]
RewriteRule ^/bar/(.*)$ http://newsite/bar/$1 [R=301,L]
는이 같은가요?
location/{
rewrite ^/(test1|foo|bar)/(.*)$ http://newsite/$1/$2 permanent;
...
}
이것은'/ test1/aaaa' 오른쪽에서도 유효합니다. – Kokizzu
@Kokizzu - 수정. 'location/test1'은 ** 접두어 일치 **이며'/ test1/aaaa'와 일치합니다. 또한'$ request_uri'는 doiman 이후의 모든 것을 포함합니다 (즉,/test/aaaa). – grochmal