Rewrite url in apache configuration

Need help about how to rewrite url in apache.

How to rewrite URL A to URL B.

URL A: project1.domainname.com
URL B: domainname.com/sites/project2

Below is my configuration, but not worked:

RewriteEngine on
RewriteCond {HTTP_HOST} ^(.).domainname.com$
RewriteRule ^(.
).domainname.com$ “http://domainname.com/sites/$1/”

please leave your idea, thanks for your help


Source: apache

Leave a Reply