
2개의 .htaccess 파일이 있어요
/public_html/의 첫 번째
#ErrorDocument 404 https://example.com/en/404.php
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/ws/
RewriteCond %{REQUEST_URI} !/en/
RewriteCond %{REQUEST_URI} !/ar/
RewriteCond %{QUERY_STRING} !lang=en
RewriteCond %{QUERY_STRING} !lang=ar
RewriteRule (.*) $1?lang=en [QSA]
다른 파일은 /public_html/jobs/에 있습니다.
RewriteOptions inherit
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} ((\d+)?)
RewriteRule ((\d+).*?) /job/index.php?JobID=$2 [QSA]
URL을 다음에서 리디렉션하고 싶습니다:
https://example.com/jobs/123
에게:
https://example.com/job/index.php?JobID=123&lang=en
하지만 결과는
https://example.com/job/?JobID=1196147
lang 매개변수 없이
왜 작동하지 않는지 모르겠고 루트 파일에 다른 많은 규칙이 있기 때문에 2개의 파일에 규칙이 필요합니다.
감사해요.
답변1
방금 같은 문제가 발생했습니다. RewriteOptions InheritBefore
대신 RewriteOptions Inherit
상위 디렉터리의 .htaccess 파일이 하위 디렉터리의 파일보다 먼저 처리되도록 하여 문제를 해결했습니다.