I have website with 3 languages and 3 domains on the single directory root.
Its working good but… I have to figure out redirect chain.
WordPress Address (URL): https://my-website.com
Site Address (URL): https://my-website.com
When I visit any of the website pages with a www version of the URL such as https://www.my-website.com/contact/, it redirects the page to non-www version https://my-website.com/contact/. This is all good.
However, the media urls don’t seem to work like this. The www version such as https://www.my-website.com/wp-content/uploads/2023/05/My-PDF-File.pdf does not redirect to the non-www URL. In fact, both the www and non-www versions work. Is this a normal behaviour with the media files? How do I fix this so that media files also redirect to non-www URLs?
]]>I have a wordpress multisite setup with subdomains but using “custom domains” – all the relevant and up to date guides say just create a new site with any old URL and save, and then go and edit the URL with your desired custom domain name. I pointed all my domains correctly with DNS and added them to my hosts platform (Cloudways). All worked well, at least so I thought!
It turns out the non-WWW version on my custom subdomain sites were pointing back to the registration page of the main site url – they were not redirecting to the relevant WWW version of my site.
There is no need for plugins to do this since latest WordPress has native domain mapping installed. Note my custom domains were added as www. domains but apparently this was no issues, despite mixed information online about this.
RESOLUTION.
I had to add additional code to my .htaccess file AND MOST IMPORTANTLY, in the right position. Adding the additional lines at the bottom of the wordpress code DID NOT WORK!
I had to add the below code; I couldn’t see that any multisite setup guides online mention this requirement, despite calling themselves the “ultimate” guides…
RewriteEngine on
RewriteCond %{HTTP_HOST} ^interexautomotive.com [NC]
RewriteRule ^(.*)$ https://www.interexautomotive.com/$1 [L,R=301,NC]
And as mentioned, the important was the position of the code and so I show you here my working resolution.
#End of expires headers configuration
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteEngine on
RewriteCond %{HTTP_HOST} ^interexautomotive.com [NC]
RewriteRule ^(.*)$ https://www.interexautomotive.com/$1 [L,R=301,NC]
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
# END WordPress
I hope this helps people in future.
]]>I’m trying to redirect https://non-www.sitename.com to https://www.sitename.com. I tried with the plugin but it’s not giving the right solution. Can you pls help?
Here’s what I tried and not working.
https://pasteboard.co/n1jJYAd6vxGb.png
PS: If I add www to the server then it gets into infinite loop and site does not open.
]]>AIO SEO says the www and non-www versions of your URL are not redirected to the same site.
I have checked wordpress and it is only using the non www version.
I have also checked google search console and there is only the non www version.
What exactly is this referring to?
]]>after site migration there was somehow non-www version created and connected to the Jetpack. How would I, in this case, merge these two versions so I can keep all my data intact?
Thank you
]]>https://www.flagshipinc.com/coronavirus
redirects to
https://www.flagshipinc.com/coronavirus
redirects to
https://flagshipinc.com/coronavirus
redirects to final URL
https://flagshipinc.com/coronavirus/`
I am having problems with my multi site. The problem is that non-www links are getting redirected to my main site’s homepage.
The situation
Main site: https://www.site1.com
Second site: https://www.site2.com
Problem
Scenario 1: When I go to https://www.site2.com, it loads second site correctly
Scenario 2: But when I go to site2.com (without www) it redirects me to main site https://www.site1.com
Does anyone know how to solve this?
(I can show the .htaccess if that helps)
Thanks in advance!
]]>