Ask To Apps
  • Home
  • WordPress
  • Elasticsearch
  • PHP
  • Linux
  • Website Peformance

Tag : wordpress

Sub Domain and Sub Directory on same wordpress installation

24/03/2013 Article

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

Tags: Sub Domain, Wordpress, Wordpress multisite

About Author:

WordPress multisite with different domain on single installation

24/03/2013 Article

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…

  • Sub – Domain
  • Sub Dir

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.

  1. Go to the My Site -> Network Admin -> Sites -> Add new
  2. It will ask you Site Address, Site Tittle and Admin Email. e.g. Lets say if you want to add www.newsite.com from www.ask4solution.org, then put site name as “newsite” and Add site.
  3.  After site added successfully you will get edit site form, where you can see site name like – “newsite.ask4solution.org”.
  4. Now we have to change site name and home url like  www.newsite.com and http://www.newsite.com/ respectively
  5. That’s All!

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

Tags: Multile Domain, Multisite, Wordpress, Wordpress multisite

About Author:

Recent Posts

  • Install and configure logstash-forwarder
  • Redirect request on php script through squid proxy
  • Alerting for Elasticsearch : Log watcher in elasticsearch using ES Watcher
  • Detect face from image using python script with OpenCV
  • Change mysql root password on centos
  • Search part of word in elasticsearch using nGram – auto-complete search
  • Connect VPN on centos linux using command line
  • Custom river plugin in elasticsearch
  • Backup elasticsearch with snapshot and restore api
  • PHP code to exact keywords from text.

Tags

apache Apache Lucene cache Distributed Elastic Index Elasticsearch elasticsearch performance Git Clone Git Hub Git Hub Configuration Git Hub Installation grep Import Install MySQL JSON over HTTP Linux Linux Command Linux Commands Linux search local file lsyncd md5sum Multile Domain Multisite MySQL Open Source optimization performance php performance real time search remote file Remote Git Hub remote sync RESTful Scale Schema Free Search Engine Search Index Search keyword static cache Sub Domain sync Very fast Wordpress Wordpress multisite

Copyright Ask To Apps 2021 | Proudly powered by WordPress

facebook twitter google linkedin Email Rss