Linked Questions

Popular Questions

I need a rewrite rule or some other solution for accessing pages like

www.domain.com/feature.php?lang=de

from

www.domain.de/feature.php

which lies at the same webspace as

www.domain.com.

From the beginning:

I have a domain

www.domain.com 

with multi language content which is triggered by a language GET parameter.

For instance:

www.domain.com/features.php?lang=fr 

will load the french content from the database, whereas

www.domain.com/features.php 

displays the default English content.

For SEO friendly clean urls I created the following universal htaccess rewrite rule:

RewriteRule ^/?(.*)/(.*).php /$2.php?lang=$1 [L,QSA]

This will make urls like

www.domain.com/features.php?lang=fr

be accessible from the SEO friendly version:

www.domain.com/fr/features.php

Also other languages like

www.domain.com/features.php?lang=it

are covered by this and can be accessed by the clean url

www.domain.com/it/features.php

What I need is a solution for the special case for the German language, because for the German language I have a dedicated domain called domain.de. So it should not be accessible by a path-url like

www.domain.com/de/features.php 

as the other languages, but instead from

www.domain.de/features.php

I probably have to point the domain target of domain.de to the same webspace as domain.com, since they share the same php files, stylesheets and images.

I don't know how to edit the htaccess file to cover the .de domain as well.

Please consider, that in addition to the hidden lang parameter, there are some pages, which need to pass some GET parameters too. They don't need to be hidden. They just need to be passed. So for instance

www.domain.com/features.php?lang=de&a=1&b=2

should be accessible from

www.domain.de/features.php?a=1&b=2

My current htaccess RewriteRule already covers the additional parameters for the .com/x/ domain by [L,QSA] at the end. But I don't know how to set it up to cover access from the .de domain, including the ocationally occuring GET parameters.

It should be a universal solution. So I should not have to enter a line for every of my php files, but instead it should cover all php filenames, as the already existing RewriteRule from above already does for the .com domain.

Thanks.

Related Questions