.htaccess: Rewrite to subdirectory with a twist -


i have domain-a.com , domain-b.com. host runs multi-site contao installation 2 sites both domains assigned respectively. both sites supposed have wordpress blog in /blog subfolder. of course realistically can not, first 1 domain-a.com/blog , second domain-b.com/blog-b.

wrapping head around .htaccess has proven difficult me , can't figure out how logic work:

if    domain domain-b  ,    request_uri starts /blog  rewrite domain-b/blog-b/$1 

i tried this:

rewritecond %{http_host} ^(www\.)?domain-b\.comt [nc] rewritecond %{request_uri} ^/blog/ rewriterule ^/(.*) /blog-b/$1 

does not work. how done?

ah, think $1 capturing /blog/ in incoming url, it's doing /blog-b/blog/...

try this:

rewritecond %{http_host} ^(www\.)?domain-b\.com [nc] rewriterule ^/blog/(.*)$ /blog-b/$1 [nc,l] 

also, depending if have rewritebase, leading slash in rewriterule may need removed.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -