apache - redirect domain www links to www-staging on staging server -
so know doable .htaccess, can't seem working.
i have staging server: www-staging.mysite.com
as production server: www.mysite.com
i want edit .htaccess
file that, on staging server, every request www.mysite.com
changed www-staging.mysite.com
.
every request on production server should function normal (www.mysite.com
).
in htaccess file of staging server (in document root), add above of other rewrite rules (if there any):
rewriteengine on rewritecond %{http_host} ^(www\.)?mysite\.com$ [nc] rewriterule ^(.*)$ http://www-staging.mysite.com/$1 [l,r]
this works if staging , production servers separate, 2 different document roots.