
URL을 리디렉션하는 중인데 이 과정에서 'RewriteRule' 지시문을 사용하고 싶었습니다.
현재 다음과 같은 규칙이 있습니다.
RewriteRule ^/application/web/reservation/index.jsp https://application.domain.com/application2/web/reservation/audioForm.zul [R,L]
그러나 첫 번째 URL 끝에 로케일이 추가된 경우에도 이것이 작동하기를 원합니다. 다양한 로케일이 있을 수 있으므로(정적은 아님) RewriteRule이 첫 번째 URL에서 '.jsp' 뒤에 오는 모든 항목을 가져와서 두 번째 URL에서 '.zul' 뒤에 배치하도록 하고 싶습니다.
예를 들어 다음과 같습니다.
RewriteRule ^/application/web/reservation/index.jsp(*)$ https://application.domain.com/application2/web/reservation/audioForm.zul$1 [R,L]
교체 부분에 대한 구문이 잘못되었다고 생각합니다.
(*)$ and $1 respectively
로케일에 따라 링크가 어떻게 보이는지 확인할 수 있도록 아래에 예를 배치했습니다.
https://application.domain.com/application/web/reservation/index.jsp?locale=de-DE
두 번째 URL에서 .zul 뒤에 '?locale=de-DE'를 배치하고 싶습니다.
내가 뭘 잘못하고 있는지 말해 줄 수 있는 사람이 있나요? 어떤 도움이라도 대단히 감사하겠습니다.
친애하는
답변1
실제로 당신의 대답은 정확하지 않습니다.
특정 항목과 일치시키려면(여기서 특정 단어가 중요합니다)쿼리 문자열, "?locale=de-DE'"를 언급한 예와 같이RewriteCond가 필요합니다그것을하고 있습니다.
그러나 이 특정 경우에는 대상 URL이 쿼리 문자열을 지정하지 않기 때문에 mod_rewrite의 기본 동작은 QSD 플래그(쿼리 문자열 삭제)를 지정하지 않는 한 원본 쿼리 문자열(어쨌든)을 여기에 추가하는 것입니다.
간단히 말해서:
RewriteRule ^/application/web/reservation/index.jsp https://application.domain.com/application2/web/reservation/audioForm.zul [R,L]
또는:
RewriteRule ^/application/web/reservation/index.jsp$ https://application.domain.com/application2/web/reservation/audioForm.zul [R,L]
"/application/web/reservation/index.jsp?whatever" 에 대한 요청과 일치
하고 지정한 대상에 쿼리 문자열을 추가합니다
.https://application.domain.com/application2/web/reservation/audioForm.zul" 쿼리 문자열을 지정하지 않기 때문입니다.
답변2
나는 실제로 몇 시간 동안 mod_rewrite API를 연구하고 조사한 후에 그것을 알아냈습니다.
Apache 모듈 mod_rewrite - Apache HTTP 서버
대신에:
^/application/web/reservation/index.jsp(*)$
나는 다음을 사용했다:
^/application/web/reservation/index.jsp(.*)