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

Tag : sub-domain

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:

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