[TYPO3-english] mod rewrite redirecting when no language is set in url

jochem nabuurs jochem at roquin.nl
Thu Feb 25 13:37:55 CET 2010


Tomas Mrozek wrote:
> Try...
> 
> RewriteRule !^(en|nl|de)/  http://%{HTTP_HOST}/en%{REQUEST_URI} [R=302,L]
> RewriteRule .* index.php [L]
> 
> Tomas Mrozek

Tomas, you made my day!

Works like a charm. Can I ask why its a 302 instead of a 301...
I don't want people (or crawlers) to ever use f.e. 
"http://www.example.com/portfolio.html" so my guess is a 301 would be 
better. But that's just a guess...

I'm now using the following for language redirection (works like a charm 
thanks to you):

# Match all urls in which no language var is present
RewriteRule !^(en|nl|de)/  http://%{HTTP_HOST}/en%{REQUEST_URI} [R=302,L]

# Rewrite all urls with only language var so that a home.html is added
# This solves the problem of having multiple homepages with the same 
language
RewriteRule ^nl/?$ http://sofon.lan/nl/home.html? [R=301,L]
RewriteRule ^en/?$ http://sofon.lan/en/home.html? [R=301,L]
RewriteRule ^de/?$ http://sofon.lan/de/home.html? [R=301,L]

RewriteRule .* index.php [L]


Thanks,

Jochem


More information about the TYPO3-english mailing list