Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to do the following:

I have about 5 URLs which has to be redirected manuall, the rest automatic means:

These ones have to be redirected manually www.mywebsite.com/test1 which has to be redirected to www.mywebsite.de/myfolder/test1 www.mywebsite.com/test2 which has to be redirected to www.mywebsite.de/thisisanother/folder/test2

The Rest (if none of the above) - no matter if I enter www.mywebsite.com or mywebsite.com has to be redirected to www.mywebsite.de/en/

To sum: I want to hardcode two redirects for test1 and test2, because they have to be redirected to somewhere else. The rest if not test1 or test2 have to be redirected to www.mydomain.de/en/ - how to do ???? – codeworxx 2 mins ago edit

I have no clue, where the problem is: I have created a .htaccess file in www root of www.mywebsite.com with the following content:

RewriteEngine on
RewriteRule test1 http://www.mywebsite.de/myfolder/test1 [R301]
RewriteRule test2 http://www.mywebsite.de/thisisanother/folder/test2 [R301]
RewriteRule (.*) http://www.mywebsite.de/en/$1 [R=301,L]

But it does not do what I want.

If I enter mywebsite.com or www.mywebsite.com I get an Internal Server Error. If I enter www.mywebsite.com/test1 it redirects to www.mywebsite.de/en/$1 ?!?!?!?

Thanks,

share|improve this question

1 Answer 1

up vote 0 down vote accepted
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/test1
RewriteRule (.*) http://www.mywebsite.de/myfolder/test1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/test2
RewriteRule (.*) http://www.mywebsite.de/thisisanother/folder/test2 [R=301,L]
RewriteCond %{REQUEST_URI} !^(test1|test2)
RewriteRule (.*) http://www.mywebsite.de/en/$1 [R=301]
share|improve this answer
    
perfect - that worked as expected! thanks :) you saved my day! –  codeworxx Aug 20 '11 at 16:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.