2

I have a CodeIgniter website in my server root directory. This website does have a lot of pages approx ~2M to ~2.5M pages with lots of other functionality. However; now I have developed one WordPress multisite for my home page and another 12 landing page. I've used WPML for the same. now I need to accomplish the following structure,

domain.com -> My CodeIgniter website.
lp.domain.com -> WordPress multisite main site.
ex1.lp.domain.com to ex11.lp.domain.com -> for my 12 landing page.

Now, When I am migrating the WordPress installation to the subdomain then it's getting in a redirection loop.

Can anyone help me with a solution that I can do for the same?

Appreciate your help in advance

1 Answers1

0

use a rewrite in the CI mainsite (after CI's rewrite script),

RewriteEngine On
RewriteCond %{HTTP_HOST} (.*)\.domain\.tld$
RewriteCond %{HTTP_HOST} domain\.tld$
RewriteCond %{HTTP_HOST} ^domain\.tld[NC]
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.tld$    
RewriteCond %{HTTP_HOST} !^(lp|subdom1|sub2dom2)\.domain\.tld$ [NC]

then a permanent redirect to,

 RewriteRule ^(.*) https://www.domain.tld/%1/$1 [L,R=302]

and then in WP,

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

the live example is here with CI, https:// www.gsunitedtechnologies .com (subdomain : https:// blog.gsunitedtechnologies .com and the same host with a multisite wp network on https:// beatthedrumfor. com (subdomain: https:// in.beatthedrumfor. com)

Arun Panneerselvam
  • 2,263
  • 1
  • 17
  • 24