I have just launched a site . I am using the https protocol. So my domain is https:// example
I created a google webmaster tools account and verified I was the owner of https:// example and https:// example
I then tried to set my preferred domain in the site settings (https:// example) and it asked to verify that I was the owner of http://example and http://www. example
So I now have 4 different verions of the site set up in webmaster tools. I set my preferred domain as example.com , it doesnt allowed me pick a prefered protocol.
My question is , how will google know to index the https:// and not the http:// ?
Redirect
Assuming you want everything indexed under https://example.com, you can redirect all requests to http://example.com, http://www.example.com, and https://www.example.com to be sent to https://example.com.
This is the best method as it keeps everything clean and only directly accessible via the one domain and protocol. Google (and all other users) will follow the redirect if they try to access any of the other variations.
rel canonical
Another alternative is to use rel=canonical and set this to the preferred domain. This allows you to still serve the same content over both protocols, the root domain, and www. subdomain, but sets the preferred domain as the one that should be indexed as the location for accessing that content.
noindex
A third option would be to specify noindex on all content served from the non-preferred domains / protocol. This would ensure that Search Engines would only index the content served on the preferred domain (which doesn't have noindex set).
But I wouldn't recommend this as it's not good for SEO - if someone links to http://example.com and you have it noindexed, that link is disregarded by SEs. Whereas if you use redirect or rel canonical, the link is counted towards the page on your preferred domain that the canonical / redirect goes to.
To be clear, whenever using redirects or rel canonical, you must point it to the corresponding page on the preferred domain.
So http://example.com/some-page/ should redirect to https://example.com/some-page/, not just https://example.com/
You can't set any of this using Google Webmaster Tools, you'll need to set it on the server hosting your website. The way to do this depends on how your server is configured.
You can tell it to google:
https://support.google.com/webmasters/answer/139066?hl=en
Indicate the preferred URL with the rel="canonical" link element
Suppose you want https://blog.example.com/dresses/green-dresses-are-awesome/ to be the preferred URL, even though a variety of URLs can access this content. You can indicate this to search engines as follows:
Mark up the canonical page and any other variants with a rel="canonical" link element.
Add a <link> element with the attribute rel="canonical" to the <head> section of these pages:
<link rel="canonical" href="https://blog.example.com/dresses/green-dresses-are-awesome" />
Related
I have jekyll-redirect-from plugin, but it only really works for pages that aren't my root homepage.
For example, if a user types in www.mywebsite.com/index.html I want it to redirect and display the URL as www.mywebsite.com
Everything I can find about this is focused on blog posts and other pages than the index. Has anyone had this issue?
You don't need a redirect, because www.mywebsite.com/index.html and www.mywebsite.com are the same page. (The browser just shows the index file by default if you go to www.mywebsite.com.)
You need the browser to rewrite the URL, while remaining on the same page. You need to do this on the webserver.
.htaccess
If your site is on an Apache server and you have access to the server, you can use an .htaccess file to rewrite the URL from www.mywebsite.com/index.html to www.mywebsite.com.
There are online .htaccess generators like this one that help get the syntax right.
There are similar methods for rewriting URLs on nginx webservers.
GitHub Pages
If you're on a service like GitHub Pages, you can't use .htaccess. A free workaround is to use Netlify to deploy your site, because you can set up redirects on Netlify. Create a free account on Netlify and add a new site from GitHub there.
In the root of your repo, create a netlify.toml file containing this:
# Redirect /index.html to /
[[redirects]]
from = "/index.html"
to = "/"
Netlify will now handle that redirect.
I moved my site domain from mysite.me to mysite.com. There are links on the web from other peoples' pages (e.g., blogger) to specific product pages on my old domain (e.g., mysite.me/cat1/prod1).
When I set up the URL Rewrite in Magento Community how do I point a specific URL from my old domain (mysite.me/cat1/prod1) to my new domain (mysite.com/cat1/prod1)?
I'm trying a Custom rewrite. I know the Target Path is relative. Is the Request Path relative too? If request path is relative than I can't do what I want.
I currently have a general 301 redirect for anything going to mysite.me to go to mysite.com. I'm assuming that I need to disable this 301 redirect at the domain level for any URL rewrite to work. However the first question to answer is if I can use URL rewrite for redirecting from one domain to another. I haven't seen a clear answer for this in my research. Just that the Target Path is relative, which makes sense, but nothing redirecting from one domain to another.
Thanks.
In the Magento installation wizard, should the base url include www or not?
Ex: www.site.com or site.com
If you plan on using a cdn to distribute your images, etc. yes, it would be a really, really good idea to have your web server use a www. host name instead of using only the bare domain name.
It's not cool when your customers start having blecherous cookie problems due to not using proper host names to sort out the different cname entries in your DNS.
Changing after the fact results in humorous non-SEO friendly reindexing by Google, Bing, et. al.
Even when I am on HTTPS, Magento's getProductUrl() always seem to return an HTTP URL. Any ways I can make this auto-switch to HTTPS? (or have it return relative protocol url).
I would say it's a rather 'standard' configuration.
Base URL is http://example.com/
Secure URL is https://example.com/
Use Secure URLs in Frontend is No
Base Link URL is {{unsecure_base_url}}
I am aware I could change the above to {{secure_base_url}} however I do not want to force a change from HTTP to HTTPS, I only need it to stay relative.
The main Magento's benefit, is that you can do anything you want with it :) So, yes, you can output HTTPS product urls or relative ones. However, before choosing a solution, let's consider the Magento authors' vision.
The HTTPS for frontend is designed to work only for specific areas like Customer account, Payment methods, Checkout, etc. There is nothing so private about products, which makes it necessary to be viewed via HTTPS as well.
By default Magento doesn't use HTTPS even for pages, mentioned above. In order to turn HTTPS on, the "Use Secure URLs in Frontend" option must be set to "Yes". Which, as described, will engage HTTPS only in limited set of pages that contain some private data.
So the best solution for you depends on specifics of the store, you are developing.
1) If you want to engage HTTPS for all the pages on frontend - then the best solution is to put "https://..." into "Base URL" option for "Unsecure" web url configuration.
2) If you want to turn on HTTPS only for product links and only for a limited number of pages, then you can override templates of that pages in order to put there relative urls. The actual code can be implemented in any way you like, even the simplest already proposed way is ok:
echo trim($_product->getProductUrl(),'http:')
3) If you want to engage HTTPS for all the product links at frontend - then the best way is to override Mage_Catalog_Module_Product_Url model and change method getUrl() - you need to put there
$routeParams['_secure'] = true;
This will produce all the product urls with HTTPS protocol.
4) If you need to show HTTP product links only at HTTP pages and HTTPS product links only at HTTPS pages, then you can use method 3) with a more sophisticated logic: check the protocol of current page before setting '_secure' parameter.
Hope, it helps.
I just did it the primitive way, sometimes it works best:
echo trim($_product->getProductUrl(),'http:')
Instead
$product->getProductUrl()
Try
$product->getUrlModel()->getUrl($product, array('_secure'=>(bool)Mage::app()->getStore()->isCurrentlySecure()))
This gives you a secure/unsecured product url based on your current protocol.
THere's an understated but important option in System | Configuration | Web ~ where you have to say "use secure url in frontend" -- if you set this to yes then a page loaded by https will use https links,
no need to write code or provide additional configuration in most cases
I have a domain (www.wozzoncornwall.co.uk) set up and followed Heroku's recommendation not to use a naked domain. I've noticed the site seems to be taking an unusually long time to be indexed by google.....i'm not talking keywords, just searching the site name or domain. I previously had a holding page up for 3-4 months and this was indexed, however, I noticed that when I moved the app to Heroku this was clicking through to the URL without the www, so returning site not found. This isn't even in the index any more, google clearly dropped it due to 'site not found' but i'm concerned this is having an effect on the proper site being indexed. Any thoughts or suggestions?
I would suggest that you use rack-rewrite (assuming Ruby app) to redirect your naked domain to the www (with a true 301 redirect) - but publish/advertise the www entry. You would need to add the naked domain to your application domains and the IP addresses - this is acceptable for simply redirection.
This should transfer the link juice from the none www to the www. If you use Google webmaster tools you can go into the settings and update them of the address change.