I've tried tons of solution that I've found but it's still not working.
I've registered 2 domains in godaddy.
1 - mydomain.com -has the main wordpress site 2 - mydomain.org
I created mydomain.org as the alias domain through mydomain.com's cpanel.
What I want is when we access to mydomain.com, it has the content of mydomain.com but the url on the address bar changes to mydomain.org.
I tried to use redirects tool in cpanel from .com to .org & this gives me error redirection.
I achieved this result by changing the site url in the wordpress to mydomain.org.
But,
both domain have https, when I entered .org, this error came out "your connection is not secure".
I used this in .htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
I'm not sure if all of these are the right approach, from setting up the alias domain as url & forcing the https for the wordpress site
Try using this code in your .htaccess file:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?example\.org$ [NC]
RewriteRule ^ http://www.example.com%{REQUEST_URI} [L,NE,P]
But this has "some" limitations - you will have to enable mod_proxy and mod_rewrite on your server, if I pressume you are using Apache server.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.