.htaccess - redirect my site from www.foo.bar to cdn.foo.bar -
is possible have htaccess rule redirect files from
http://www.mydomain.com/page.html
http://cdn.mydomain.com/page.html
still making link http://www.mydomain.com/page.html
i know masking urls isn't possible, since on same domain wondering if possible
try these rules in .htaccess file:
options +followsymlinks -multiviews rewriteengine on # http rewritecond %{http_host} ^www.mydomain.com$ [nc] rewritecond %{server_port} =80 rewriterule ^(.*)$ http://cdn.mydomain.com/$1 [l,r] # https rewritecond %{http_host} ^www.mydomain.com$ [nc] rewritecond %{server_port} =443 rewriterule ^(.*)$ https://cdn.mydomain.com/$1 [l,r]
however 1 caveat external redirect hence url in browser change http://cdn.mydomain.com/foo
because when jumping 1 host cannot have internal redirect hence r
flag needed.
Comments
Post a Comment