apache - redirect url with mod_rewrite at .htaccess and keeping domain ending -


i try that:

www.domain1.com/some-ending or domain1.com/some-ending www.domain2.com/some-ending

if url called or without www, second domain should opened corresponding ending (/some-ending), variable.

this code far, need ending in there:

rewriteengine on rewritecond %{http_host} ^(www\.)?domain1\.com$ [nc] rewriterule ^(.*)$ http://www.domain2.com/$1 [r=301,l] 

your code looks ok , added optional "/" pattern can accept url ending "/" , "nc" flag case-insenstivity.

rewriteengine on rewritecond %{http_host} ^(www\.)?domain1\.com$ [nc] rewriterule ^(.*)/?$ http://www.domain2.com/$1 [r=301,l,nc] 

Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -