HTTP Module causing problem with Google Cache - sharepoint

I have a live site ( I can't provide the URL ).
It is on sharepoint 2007. The pages were having a URL, later that was modified.
I wrote a http module and used response.redirect() to navigate user to the correct page.
But since the site was live previously; on searching on google.com, it shows the old URL only. Though the redirection works fine. I need to change the cached URL to new URL.
How can I do that ?

You need to understand the different redirect codes - by itself response.redirect() just redirects a browser (or bot) to another address.
You should have been issuing a 301 redirect then Google and other services (its been roumered that there are a few other games in town) would have eventually removed the old URL and replaced with the new URL and all your 'link juice' would be kept.
If you need to change the URL of a
page as it is shown in search engine
results, we recommended that you use a
server-side 301 redirect. This is the
best way to ensure that users and
search engines are directed to the
correct page. The 301 status code
means that a page has permanently
moved to a new location.
ASP.NET code for this
Response.Status = "301 Moved Permanently"
Response.addheader "Location", "http://www.newdomain.com/newurl/"
Response.end

Try to look here. Not sure, but it can help you.

Related

IIS Rewrite rules stripping .ASPX, but Google Analytics still showing

I've implemented IIS 7.0 rewrite rules for my site which strips out the .aspx extension, makes the URL lower case, and strips "default.aspx" to clean up the URL, and all of the rewrite rules work great.
However, in looking through my google analytics reports for a time period after the rules were put into production, under "Behavior", "Site Content", some of the entries still show the extension. For example, it shows these pages being hit:
/about/
/about/default.aspx
There is no way the rule isn't working for /about/default.aspx, and I can go to that URL and it redirects to /about/
So what is going on here? Analytics shouldn't know anything about default.aspx since all of those rules are done on the server before anything is returned to the client.
If your site uses redirects, the redirecting page becomes the landing page's referrer. For example, if you've changed your site so that default.aspx now redirects to /, then root folder(/) becomes the referrer for default.aspx. If someone reached your site via a Google search that sent them first to default.aspx, you won't have any data regarding the Google search.
For this reason, you should place the Analytics tracking code on the redirecting page as well as on the landing page. This way, the redirecting page will capture the actual referrer information for your reports.
By doing this, you may get the analytics log only the redirected url.
Figured it out. The GA Filters were set up to append "default.aspx" to any page which didn't have a page defined.
For example, if I went to
/about/
it would report as /about/default.aspx
But if I went to
/about/features
(features.aspx is a page)
it would not append it!

Getting redirected URL in python 3

I want to get the address of a page after redirect. I have the following code
url = 'https://simple.wikipedia.org/wiki/Gcd'
print(urlopen(url).geturl())
But it doesn't work, it prints https://simple.wikipedia.org/wiki/Gcd, while it should print https://simple.wikipedia.org/wiki/Greatest_common_divisor.
So, what is the problem with it?
There is actually no problem. The URL you get when opening https://simple.wikipedia.org/wiki/Gcd is exactly that URL. The only way for the URL to change would be a redirect, and if you look at the response from that URL, you can see that it returns just a 200 status code. So there is no redirect.
However, when you open the URL in the browser, the URL does get changed to https://simple.wikipedia.org/wiki/Greatest_common_divisor. How does this happen when there is no redirect?
This is actually a new MediaWiki feature that rewrites the URL in the browser using the History API. It simply replaces the URL that is displayed in the browser—but without actually making a new request or being a true HTTP redirect.
It’s a functionality that only works in modern browsers with JavaScript enabled. Otherwise, you would stay on the Gcd URL which is also the behavior from older versions of MediaWiki.
You can learn more about this new MediaWiki feature in the Phabricator task T37045.
As for your “problem” with it, you should consider communicating with MediaWiki using the MediaWiki API which will also tell you when a page is a redirect.

Is it possible to have a url redirect to another page and keep the original url in the title bar?

A marketer in my company has a landing page on our site: www.importantcompany.com/amazingproduct
They have a vanity url that goes to the landing page:
www.amazingproduct.com
I successfully created the iis redirect rule. However, the marketer has comeback and would like to keep the redirect rule, but keep the address in the bar www.amazingproduct.com instead of www.importantcompany.com/amazingproduct
I'm assuming that this is not possible.
The only way to make this work is to create a new site in iis and copy the landing page into the new site and set the new site to go to www.amazingproduct.com
Please let me know if my assumption is correct.
Thanks!
Your assumption is incorrect.
You could write a filter on IIS that looks at the requested URL and notes if "www.amazingproduct.com" is sent in to do a "Server.Transfer" of the request to the subfolder that would be one solution that wouldn't require a new site at all.
URL Rewrite could also be another way to configure a way around this to some degree.

Difference between IIS Redirect and Rewrite (in relation to redirecting)

The question may sound odd, but given an article, it is definitely possible to use the rewrite module to perform redirects just as with the redirect module. Both are able to issue a permanent redirect (301).
There is a question asking for the difference, but it talks about the rewrite module being used to purely rewrite not redirect. Another post makes this clear, but doesn't seem to get an adequate answer.
Hence, my question: What's the difference between these modules? Which is preferred over the other when it comes to redirects?
NOTE: THIS ANSWER DOES NOT answer difference between IIS Redirect (httpRedirect) vs URL Rewrite Module's Redirect but rather difference between URL Rewrite Module's (redirect vs rewrite).
If you are trying to hide complex URL (with querystrings) to more friendly URLs then Rewrite is the way to go as browser/Search Engines will always see 200OK and assume the content is coming from requested original URL.
If you are trying to indicate a change of resource to search engines/users of new URL then Redirect is the way to go as you are sending 301 status code saying that resource has moved from original to this new location.
IIS Redirect:
Redirecting happens at Client Side
Browser sees a different URL In address bar.
Client aware of a redirect URL.
301/302 can be issued. Edit: (303/307 can be issued too)
Good for SEO/Search Engine to indicate of new URL. mysite.com/abc to mysite.com/pqr
Can be redirected to same site or different site altogether.
IIS Rewrite:
Redirecting happens at Server Side
Browser does not see new URL in address bar.
Client unaware if content is served from a re-written URL.
No 301/302 are issued. This will have normal 200 OK assuming that rewritten URL Resource is available.
Good to hide unfriendly URL and also SEO. mysite.com/article/test-sub/ to mysite.com/article.aspx?id=test-sub
Generally for a resource within same site.
Request Handling (REDIRECT): www.mysite.com/abc to redirect to www.mysite.com/pqr
Client calls: www.mysite.com/abc
URL Rewrite Module sees a rule match for client URL and gives new redirect URL.
Server responds with 301 with new URL for client to call www.mystite.com/pqr
Client calls new URL www.mystite.com/pqr
Server responds with 200 OK for new URL. (address bar shows new URL)
Request Handling (REWRITE): www.mysite.com/abc which you want to point to www.mysite.com/pqr
Client calls: www.mysite.com/abc
URL Rewrite Module sees a rule match and provides new rewritten url to IIS i.e. www.mysite.com/pqr and Server makes request for that URL within IIS.
Server responds with 200 OK for original URL but with content from rewritten url. (address bar shows original URL and client does not know that you are serving content from different URL)

how to use old URls as it is in new drupal site

I am migrating an asp site to drupal.the existing site node URL is as
story.asp?sectioncode=1&storycode=49667&c=1
to use the same urls in drupal site i add the URL in URL aliases.when i click on any article it it showing as
story.asp%3Fsectioncode%3D1%26storycode%3D49667%26c%3D1
in the browser.how to remove %3D,%26,%3F from the URL and when i copy and paste the old url in the browser it is not redirecting me to the actual page giving 404 not found page.could some one please help me how to manage my old URLs as it is in new site.
You're not supposed to type something like story.asp?sectioncode=1&storycode=49667&c=1 as an URL alias.
There's a better way to do that. Try installing redirect module and add a new 301 redirect rule from story.asp?sectioncode=1&storycode=49667&c=1 to your new node's URL node/1.
So, whatever any user / search engine visits story.asp?sectioncode=1&storycode=49667&c=1, they will be redirected to node/1. or whatever the path you have given to the 301 redirect rule.
Hope this Helps... Muhammad.

Resources