php - Wordpress -multi urls for the same site -


i have wordpress site (v4.2.2) domain name www.example.com , need point second local domain variant www.example.co.za same site.

have tried many suggestions modifying wp-config.php, index.php , .htaccess, failed work.

for index.php

<?  // check domain , change proper spelling if necessary $our_server = "example.com";     $our_http = "http://www.example.com";    if  ( isset($http_host) && !eregi($our_server, $http_host)) {         header("location: $our_http$request_uri");               exit;    }  ?> 

for .htaccess

rewriteengine on rewritecond %{http_host} ^(www\.)example\.co.za$ [nc] rewriterule ^ http://www.example.com%{request_uri} [r,l,ne] 

i appreaciate guidance on topic on how redirect www.example.co.za www.example.com

if trying have multiple domains single wordpress install, need couple of things.

you need add dns a record , point 2nd domain ip address of main domain.

you need add domain alias in apache serveralias *.example.co.za

then edit wp config @ http_host dynamic instead of using hardcoded domain.

define('wp_siteurl', 'http://' . $_server['http_host']); define('wp_home', 'http://' . $_server['http_host']); 

using .htaccess rules have redirect not going give domain same content. redirect main domain.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -