Domanda

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

È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top