Jump to content

Domainname changes permanent redirect on the same installation htaccess settings?


mr-fan
 Share

Recommended Posts

Hi,

i've a installation where the client have to change the domainname on a existing installation.

beside the negative SEO effects how to get it proper done with PW?

i've set $config->httpHosts and Host to the according domains the PW accept both.

but all links should only use the new main domainname like:

https://olddomainname.com    -> redirected to https://newdomainname.com

how to implement it via htaccess right so that i don't blow it up. Subpages dont change only the hostname?

RewriteRule ^(.*)$ http://newdomainname.com/$1 [R=301,L]

isn't working?

Pagepathhistory and jumplinks are installed to catch 404 or other stuff.

Kind regards mr-fan

Link to comment
Share on other sites

  • 2 weeks later...

found a solution ....maybe someone yould use it sometimes...

setup only the right HOST under the config.php nothing else

/**
 * Installer: HTTP Hosts Whitelist
 *
 */
 
$config->httpHosts = array('newdomain.com');

in the htacess i've setup a additonal redirect to the existing force https and redirect www to nonwww for catching all oldomain.com calls to redirect to newdomain.com - all links should be working perfect after that switch under the new domain...the rest is fixing seo mess that comes with domain url chaning ?

kind regards mr-fan

  # -----------------------------------------------------------------------------------------------
  # 9. If you only want to allow HTTPS, uncomment the RewriteCond and RewriteRule lines below.
  # -----------------------------------------------------------------------------------------------
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
 
  RewriteCond %{HTTP_HOST} olddomain.com$ [NC]
  RewriteRule (.*) https://newdomain.com%{REQUEST_URI} [L,R=301]
 
  RewriteCond %{HTTP_HOST} ^www\. [NC]
  RewriteRule (.*) https://newdomain.com%{REQUEST_URI} [L,R=301]
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...