Tag : wordpress
Tag : wordpress
It is very simple to configure wordpress multisite with sub-domain and sub directory. Do as follows.
define('t2vhyu85e1_ALLOW_MULTISITE', true);
define( 'MULTISITE', true );
if($_SERVER['HTTP_HOST']==
'www.newsite.com')
{
define( 'SUBDOMAIN_INSTALL', false );
}
else{
define( 'SUBDOMAIN_INSTALL', true );
}
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'www.ask4solution.org' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
Trick is as wordpress loads from HTTP_HOST we can also say to wordpress based on the same.
We need to add combined htaccess rule for the same.
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ – [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
RewriteRule ^(.*.php)$ $1 [L]
RewriteRule . index.php [L]
# END WordPress
Categories: Wordpress
After installation of core wordpress if you want to setup wordpress multisite on same installation then do as follow.
/* Multisite */
define('t2vhyu85e1_ALLOW_MULTISITE', true);
Wordpress will ask you setup multisite of two type…
Select Sub-Domain type as it required for setup different domain. After wordpress network setup correctly logout and login back.
Add different domain on single wordpress code.
DNS settings
Now one thing we have to do related with domain name, we need to point www.newsite.com to www.ask4solution.org of document root. WordPress will serve www.newsite.com on the same installation.
 WP-CONFIG setting
We need to set cookie domain
if(stristr($_SERVER['HTTP_HOST'],
'newsite.com'))
{
define('COOKIE_DOMAIN','.newsite.com');
}
else{
define('COOKIE_DOMAIN',
'.ask4solution.org');
}
Categories: Wordpress