Wednesday 15 July 2015

.htaccess - Rewrite subdomain to folder in another domain -



.htaccess - Rewrite subdomain to folder in another domain -

i understand basics of .htaccess rewriting, next confuses me bit...

what want rewrite subdomain 'sub.domain.com' in way looks files of 'seconddomain.com/folder/'. without simple 301 redirect, want maintain showing url 'sub.domain.com'.

so 'sub.domain.com/file.html' should content of 'seconddomain.com/folder/file.html'.

who can help me right htaccess-rules? in advance.

(i assume can accomplished easiest .htaccess rewriting, if have improve solution same, allow me know!)

well tried, redirects , adds 'public_html' redirected url (so subdomain 'mijn.pingweb.nl' , folder redirect 'factuur.pingweb.nl/klanten/':

rewriteengine on options +followsymlinks -multiviews # handles http redirect sub-dir rewritecond %{request_filename} -d rewritecond %{server_port} =80 rewritecond %{http_host} ^(.+\.)?mijn\.pingweb\.nl$ [nc] rewriterule ^/?(.*)$ http://factuur.pingweb.nl/klanten/feed?v=$1 [r=301,l,qsa,ne] # handles http redirect non sub-dir rewritecond %{request_filename} !-d rewritecond %{server_port} =80 rewritecond %{http_host} ^(.+\.)?mijn\.pingweb\.nl$ [nc] rewriterule ^/?(.*)$ http://factuur.pingweb.nl/klanten/$1 [r=301,l,qsa,ne] # handles https redirect sub-dir rewritecond %{request_filename} -d rewritecond %{server_port} =443 rewritecond %{http_host} ^(.+\.)?mijn\.pingweb\.nl$ [nc] rewriterule ^/?(.*)$ https://factuur.pingweb.nl/klanten/feed?v=$1 [r=301,l,qsa,ne] # handles https redirect non sub-dir rewritecond %{request_filename} !-d rewritecond %{server_port} =443 rewritecond %{http_host} ^(.+\.)?mijn\.pingweb\.nl$ [nc] rewriterule ^/?(.*)$ https://factuur.pingweb.nl/klanten/$1 [r=301,l,qsa,ne]

.htaccess mod-rewrite redirect

No comments:

Post a Comment