문제

I need to redirect people who type

domain.com/jp or www.domain.com/jp

to

www.domain.com/lang=jp

My .htaccess already includes this

RewriteEngine On
rewritecond %{http_host} ^domain.com$ [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

Thank you for any help

도움이 되었습니까?

해결책

This should work

RewriteEngine On
RewriteRule ^([^/]+)$ http://www.domain.com/lang=$1 [R=302,nc]

Change R=302 to R-301 when you are sure the redirect works.

EDIT:

RedirectMatch 302 /jp http://www.domain.com/lang=jp
RedirectMatch 302 /cz http://www.domain.com/lang=cz
RedirectMatch 302 /eng http://www.domain.com/lang=eng
RedirectMatch 302 /en http://wwwdomain.com/lang=en
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top