I used the following code to redirect all the HTTP pages of a site to the https:// version.  &lt;link rel="canonical" href=""&gt; &lt;script&gt;     var url = window.location.href; // get current URL     var link = document.querySelector('link[rel=canonical]'); // get the link element     var changedUrl = [url.slice(0, 4), 's', url.slice(4)].join(''); // change the URL to https://     link.setAttribute('href', changedUrl); // set href attribute of link element &lt;/script&gt;   Now my questions is, will Google read the dynamically generated canonical tags and index them like normal canonical tags? Or will I have to try another approach?
122561
Most sources of documentation state that one can declare a webpage a duplicate of another by applying this tag on the duplicate page:  &lt;link rel="canonical" href="(absolute URL to original page)"&gt;   I could generate the above tag via the script below:  &lt;script&gt; var l=document.createElement('Link'); l.rel='canonical';l.href='(absolute URL to original page)'; document.getElementsByTagName('head')[0].appendChild(l); &lt;/script&gt;   My question is, would google be able to process this javascript and believe I'm declaring the page as a duplicate page? or would I be forced to use the link tag in the header?  I ask because I'm trying to reduce the unnecessary bytes required to be processed before the actual user readable content begins.
31987
In my site I'm redirecting everything (http://, http://www., https://) to https://www.example.com.  Google webmaster tools says: Make sure you add both "www" and "non-www" versions for your site. Also, if you use the HTTPS protocol, add those variations as well.  So I've added all the FOUR versions to google webmaster tools. Is this a correct process?
49067
I need to remove HTTPS results from Google search rankings for the domain A that has been redirected to another domain B. So domain A does not have any pages on it at the moment and it will not have in the future. Customers still go to Google and type company domain A, Google gives them HTTPS version of it as SSL certificate was installed at some point in the past. When they click on it (HTTPS version), redirection does not work as I can't redirect HTTPS but only HTTP.  So how do I remove or ask Google to remove HTTPS version? My client does not know whether HTTPS site was submitted through webmaster tools before and does not have any Gmail accounts for me to check what has happened in the past.
33107
I'm writing a program that reads content from a user provided URL. My problem is in the code that goes something like this: Uri uri = new Uri(url); WebRequest webRequest = WebRequest.Create(uri); WebResponse webResponse = webRequest.GetResponse(); ReadFrom(webResponse.GetResponseStream());  And this is breaking if the provided url is an https:// URL. Can anyone help me with changing this code so that it will work with SSL encrypted content. Thanks.
124016
I have built a basic data entry application allowing users to browse external content in iframe and enter data quickly from the same page. One of the data variables is the URL. Ideally I would like to be able to load the iframes current url into a textbox with javascript. I realize now that this is not going to happen due to security issues.  Has anyone done anything on the server side? or know of any .Net browser in browser controls. The ultimate goal is to just give the user an easy method of extracting the url of the page they are viewing in the iframe It doesn't necessarily HAVE to be an iframe, a browser in the browser would be ideal.  Thanks, Adam
38609
On our team site we have added a web part that is a "Picture Library Slideshow" web part. Currently clicking on the images that scroll in the slideshow directs the browser to just the image's URL. I would like to modify that to point to any other URL of my choice.   I have tried forcing a modification of the javascript that is generated by the slideshow webpart using my own script on the page. Looking at the source, the Picture Library uses a var that actually sets the links, it's called "linkArray":  var pictureArray = ['http://intranet/HomePicture/_w/image1.jpg','http://intranet/HomePicture/_w/image2.jpg']; var linkArray = ['http://intranet/HomePicture/image1.jpg','http://intranet/HomePicture/image2.jpg']; var titleArray = ['','']; var descriptionArray = ['','']; var heightArray = [268,268]; var widthArray = [383,383];   Using my own script I tried to clear out the array and insert my own links into it, but for some reason the links only update (i.e. my script's function runs) after the first image changes. Even if I manually change the first image's href tag, the script still thinks the "first" image is the second one that the slideshow scrolls to. Is there a way to force the function to overwrite the existing javascript immediately on page load?
104675
I started weeding through my site's search results from Google today, using a site: search, to determine if there are any links that cause 404s and thus need redirecting. To my amazement I noticed numerous https:// results relating to various pages. My site doesn't have a SSL certificate, doesn't serve such pages, doesn't internally link to https:// pages, doesn't include any such files in its sitemap.xml and, for all of these, never has.  I decided to do a Google search for https://&lt;my site&gt; and found one site that incorrectly refers to the root of my site with a https:// prefix - I will try to contact them to get them to correct this.  I'm not sure however how Googlebot managed to index the non-root files as https://. I can't find any external links to them and surely, without certification, Googlebot should have stalled at the first request?  I've just added the following lines to the site's .htaccess (although the surfer still has to navigate through the browser's "This site is a security risk. Abandon hope all ye who enter here!" message(s) first to get there):  RewriteEngine On RewriteCond %{HTTPS} on RewriteRule ^(.*)$ http://www.&lt;my site&gt;.org/$1 [R=301,L]    replacing &lt;my site&gt; with my domain name.   My big question is this though - I would like to use the Google Webmaster Tools Remove URLs feature to remove the https:// pages from the index. Can I be guaranteed that this will only remove the https:// versions of each relevant page and not the valid http:// versions?  My thanks to anyone who can help me out with this particular question and the issue in general.
90696
About 6 months ago I rolled out a site where every request needed to be over https.  The only way at the time I could find to ensure that every request to a page was over https was to check it in the page load event.  If the request was not over http I would response.redirect("")  Is there a better way -- ideally some setting in the web.config?
99762
Currently, neither protocol-relative URLs, nor relative URLs, are recognized by the system as pointing to questions to be added to the "Linked" list for the current question. Given the pending switch to using HTTPS on Stack Overflow, and later on the entire Stack Exchange network, we should, at least, recognize protocol-relative links to questions as "Linked".  Investigation  I entered the following links into a comment to point to a potential duplicate1:  [Is there a JavaScript/jQuery DOM change listener?](//stackoverflow.com/q/2844565) [Is there a JavaScript/jQuery DOM change listener?](//stackoverflow.com/questions/2844565) [Is there a JavaScript/jQuery DOM change listener?](/q/2844565) [Is there a JavaScript/jQuery DOM change listener?](/questions/2844565)   All of the above resulted in valid links to the question. None of these were picked up by the system to be considered as "Linked". By "Linked", I mean that the sidebar shows a "Linked" heading. What I expected to see was:    In order to get the question to show up as "Linked", I had to use a fully qualified URL:  [Is there a JavaScript/jQuery DOM change listener?](http://stackoverflow.com/q/2844565)   The code  We know from  that the code responsible for identifying "Linked" questions is:  public static Regex GetQuestionUrlRegex() {     return new Regex(@"https?://" + Regex.Escape(Current.Site.BaseHostAddress) + @"(?:/q(uestions)?/(?&lt;qid&gt;\d+)|/a/(?&lt;aid&gt;\d+))", RegexOptions.IgnoreCase); }   It seams that the Regex could be changed to something like (untested):  public static Regex GetQuestionUrlRegex() {     return new Regex(@"(?:https?:)?(?://" + Regex.Escape(Current.Site.BaseHostAddress) + @")?(?:/q(uestions)?/(?&lt;qid&gt;\d+)|/a/(?&lt;aid&gt;\d+))", RegexOptions.IgnoreCase); }   This change would allow the recognition of fully qualified links, protocol-relative links, and relative links.  A potential issue is that I don't know what text is being checked by this generated Regex. If this regular expression is being used to check the entirety of the raw HTML, then allowing it to pick up such shortened URLs may not be appropriate. If it is only testing active links, then it is reasonable to recognize the shorter, valid, URLs.    Notes:   A  regarding only relative links was declined at that time.  I'm unsure if this post should be considered a bug report or a feature request. I consider it a bug. However, given the previously declined bug report, the current functionality could reasonably be considered a misfeature. In such case, this would then be a feature request.   1. I'm currently out of close votes, so was unable to vote to close the question.
24818
I have the schema with this:  &lt;sitemapindex xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"&gt;   Is it correct or should be:  &lt;sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"&gt;   if all my web pages are on HTTPS?
191
Firstly, I want to redirect an old domain to a new domain, (old site to new site).  The old site has good ranking on Google, now if I redirect the site, I want to retain this site on the Google rankings and want to develop the new site's SEO.   What would be the best redirect to use? When a Googlebot re-crawls the old site after its been redirected, would the search results still show the keywords and source code on the original old site (as the page is still on the old server)? the new sites will have near identical /products.html pages and contact us pages etc. Will these all be automatically forwarded? What is ideally the best way to preserve the old site as well as redirect users that go on the old site straight to the new site, i was thinking of using some sort of CSS code which can blank out the page, or add a new layer or white to it, so the keywords remain?
32485
I'm including \usepackage{hyperref} so that each instance of \ref (as well as each page number in the index and the table of contents) automatically links to that page.  When I'm viewing the document (in ) and I click a link, I jump to the linked page.  Is there any easy way to go "back" to where I was before I clicked the link?  (And is the answer any different when using Adobe Acrobat reader?)
3872
Is there a simple way in .NET to quickly get the current protocol, host, and port? For example, if I'm on the following URL:  http://www.mywebsite.com:80/pages/page1.aspx  I need to return:  http://www.mywebsite.com:80  I know I can use Request.Url.AbsoluteUri to get the complete URL, and I know I can use Request.Url.Authority to get the host and port, but I'm not sure of the best way to get the protocol without parsing out the URL string.  Any suggestions?
121087
Is it possible using  to select all &lt;a&gt; links which href ends with "ABC"?  For example, if I want to find this link &lt;a href="http://server/page.aspx?id=ABC"&gt;
63190
I have changed my website from HTTP to HTTPS.  At this moment, I have the next rewrite rule working to redirect calls for HTTP to HTTPS:  RewriteEngine On  RewriteCond %{SERVER_PORT} 80  RewriteRule ^(.*)$ https://example.net/$1 [R,L]    Should I write the URLs on the sitemap with HTTP or with HTTPS? (including the homepage)
112425
I want to get the URL for my site collection. One way I thought I could do it was using the window.location in javascript and getting it that way.   I know that you can use ECMA script and the client object model to do this but unsure how.  I have tried:  var context = new SP.ClientContext; alert(context.get_url());   This is returning /  How would I get it to include the full URL? i.e. http://mysharepoint:29292/
35693
My home page could be potentially linked as:  http://example.com http://example.com/ http://example.com/?ref=1 http://example.com/index.html http://example.com/index.html?ref=2  (the same page is served for all those URLs)   I am thinking about defining a canonical URL to make sure Google doesn't consider those urls to be different pages:  &lt;link rel="canonical" href="/" /&gt; (relative) &lt;link rel="canonical" href="http://example.com/" /&gt; (trailing slash) &lt;link rel="canonical" href="http://example.com" /&gt; (no trailing slash)   Which one should be used? I would just slap / but messing with canonical seems like a scary business so I wanted double check first.  Is it a good idea at all for defining a canonical URL for a home page?