about.php? lang = en과 같은 URL이 있는데 about.php / en으로 변경하고 싶습니다.
<pre>
RewriteCond %{THE_REQUEST} ^GET\ /\?(([^&\s]*&)*)lang=([^&\s]+)&?([^\s]*)
RewriteRule ^(.*)$ /lang/%3?%1%4 [L,R=301]
</pre>
htaccess에서는 작동하지 않습니다.
이것을 사용할 수 있습니다.
RewriteEngine on
#redirect /about.php?lang=lang to /about.php/lang
RewriteCond %{THE_REQUEST} /about\.php\?lang=([^\s&]+) [NC]
RewriteRule ^ /about.php/%1? [L,R]
#internally forward /about.php/lang to /about.php?lang=lang
RewriteRule ^about\.php/([^/]+)/?$ /about.php?lang=$1 [L]
마지막을 제거하지 않습니까? 그렇지 않으면 mod-rewrite는 이전 쿼리 문자열을 대상 URL에 추가합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다