Canonical links are typically used when you have multiple URLs on the same domain pointed at the same content to prevent search engines from indexing duplicate content.
In this case, redirecting the domain is probably the best option.
You can do that either through the control panel for your domains or with a .htaccess file.
The .htaccess Method
You will need to create a file named .htaccess
in the web root of your site that instructs the web server to redirect traffic.
For example, if you’d like to redirect example.net
to example.com
you could do something like
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)\.example\.net [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301]
RewriteCond %{HTTP_HOST} ^example\.net [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301]
</IfModule>
Related Posts:
- Dynamically change page title from URL param
- WordPress Primary Category Changes After Import, Permalink Issue
- Workaround for og:image unsupported webp image type, Yoast SEO?
- How rewriting a url to make it SEO friendly
- mysterious issue with stop words in urls not working – how can I restore multiple url access?
- Duplicate pages with ?s parameter
- What purpose does /embed/ URL have and how to avoid SEO problems?
- Problem with guids and absolute links
- How to remove /index.php/ from URL’s
- WPML Get url without outputting
- Weird: /?name in URL leads to blog
- I am Looking to append URL Parameter to all URLs
- Is dynamic URL possible in WordPress
- Accessing the Current URL in a Text Widget for a Facebook Share Button?
- Is ‘name’ a reserved word in URL’s?
- How to create a custom page base on URL for WordPress?
- How to make menu items active based on hash
- Use image url with add_image_size
- Multiple domain names for one site
- How to always rewrite author archive page URL even if the author does not have a post
- Get a permalink structure of /%posttype%/%category%/%postname%
- How to delete unused URL?
- urlencode query string in gravity forms confirmation redirect
- Pages other than Home page not displayed even when URL is good
- Moving a test WP site to live
- How do I write the link from front-page.php to home.php?
- Should I set the html base url when using wordpress?
- how to make URL link query string
- Problem with change url for all subpages (.htaccess)
- Displaying Post with Custom URL with RewriteRule or add_rewrite_rule
- How may I see all the pages on my wordpress website and see when they were created?
- WordPress Sitemap including pages that aren’t there
- How to get URL for the first page of post archive
- Imported 10 000+ posts, custom field showing link not displayed
- Newline URL entity when using esc_url()
- SEO optimization gone not so well
- How to auto gen. custom post type values in other custom post type in url?
- How to add URL-Parameter for Javascript Widgets?
- Facebook og:image issues after https change [closed]
- previous_posts_link and next_posts_link, how to return the next/previous post’s title as the url
- Get Top parent url
- hide wp-content from urls
- Changing the website URL to the root folder
- URL issue after migrating to dev site
- Open editor post in a popup
- Renamed my website (URL) – how do I rename all within-page links to the old URL?
- Moving a WordPress site – Installation issue
- Organizing the Navigation Menu
- What can I replace ‘.get_bloginfo(‘url’).’ with to return the current URL rather than the home address?
- How to get CGI variables?
- What is the best way to figure out which template file that a “pretty permalink” is using?
- WordPress Subcategory Creates 2 urls for same page (serious issue)
- Adding a H1 Tag to Post Tags automatically, but hide the tag? (Same for Category)
- How to remove WordPress Virtual Robots.txt that keeps overriding my root robots.txt? [closed]
- How to see an item in the admin from its URL? (not sure if it’s a page, post, or what)
- Cannot access WordPress website from external IP while internally it is working properly [closed]
- Nginx WordPress and another Web app URL structure
- Pass form input via url variable
- Rewrite Most WordPress URLs
- Wrapping add_query_arg with esc_url not working
- How to make WordPress urls matching static html urls
- Hook for feed creation?
- Setting up robots.txt with Yoast’s Seo plugin
- How to show Specific URL of WordPress on Any one Specific IP only?
- Go back to my home page
- Changed domain name and all the 301 redirects work except the ones for the thumbnail image which return 403 Forbidden error
- Thousands of unwanted URLs/pages with “0” in slug created
- How to make a seo friendly URL of 2 different pages with same words
- How to remove % character from url
- Can non-latin characters appear in slugs?
- Why “?v=hash” is added to my URLs? [closed]
- WordPress inserting ?q= in URLs
- SEO Site Title appearing in google search despite not being added
- Set A Cookie To URL Parameter, Pass Cookie From Page To Page To Alter Post
- Embed ACF URL Field in WP title field
- how to set url in admin option page
- How to properly setup MAMP and XIP
- What does this structure of the URL mean? http://www.example.com/?i=0
- Post URL duplication adds numerical value
- How to create URL for Pages/Posts
- Do not output category and tag URLs
- Private Messages between users
- Navigation and Permalink not getting correctly
- How to create a dedicated folder for specific role via registration
- WordPress custom form post to different page
- Two domain site: Link base URLs point to wrong domain
- How to set global variable in functions.php
- Why am I seeing ‘yes’ and ‘no’ in URLs crawled by Xenu?
- Duplicate content with the same URL, google authorship
- URL with without www shows just a blank page
- How to create custom authors links
- Using functions concatenated with strings inside a variable
- Modify WordPress to not replace + (plus) characters from URLs?
- How to remove slug from url (custom post type)
- Accessing a file saved outside webroot in a wordpress post
- URL, which automatically close tab
- How can I implement an Article Wizard for non-existing URLs? [closed]
- Replace media external links with local links
- WordPress rewrites my link with custom URL scheme to http(s)
- Show page name after home url