htaccess to redirect from domain with sub-directory url to the same url on sub-domain

Posted by Ibrahm Yaser on Stack Overflow See other posts from Stack Overflow or by Ibrahm Yaser
Published on 2014-05-27T09:23:00Z Indexed on 2014/05/27 9:24 UTC
Read the original article Hit count: 296

Filed under:
|
|

i have problem of redirecting from domain with sub-directory like

http://mydomain.com/project/01/117q803789s92d01 or
http://mydomain.com/project/08/117t803789s92d08

.. etc

to always

http://ww2.mydomain.com/project/01/117q803789s92d01 
the other link will to 
http://ww2.mydomain.com/project/08/117t803789s92d08

... etc

i tried this

RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
RewriteRule ^project\/\/?(.*)$ "http\:\/\/ww2\.mydomain\.com\/project\/$1" [R=301,L]

but for some reason its always redirect me to wrong with missing "\" like if i try to access

http://mydomain.com/project/01/117q803789s92d01

redirect me to

http://ww2.mydomain.com/project01/117q803789s92d01

Did I miss something?!

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about mod-rewrite