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

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!

Related

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.

Redirect anything not already redirected with 301 on IIS7

We recently setup a new website on a new domain using WordPress, to replace our old website using flat files. Because of time constraints, we had little time to plan and ended up having someone setup the redirects in IIS Manager.
This means that almost every folder in the old website has something like the following for each page:
<location path="old-file.html">
<system.webServer>
<httpRedirect enabled="true" destination="http://new-domain.com/new-page/" exactDestination="true" childOnly="true" httpResponseStatus="Permanent" />
</system.webServer>
</location>
The problem is that this was a massive site with ~15k pages and only about 1k pages were manually redirected to new URIs. This means we have potentially 14k pages of legacy content (effectively dead URLs, some of it is so old) but we need to it redirect to the root of the new domain.
So almost every folder has a web.config with one instance of the codeblock above for each page redirected, but we need every page that wasn't redirected in this manner to redirect to a fixed location.
Manually configuring isn't an option because of the number of pages. I thought about using a tool to add a line of PHP to handle the redirect to every .php and .html file (PHP had to parse html files on this site for legacy content) but it's far from ideal.
Ideally, there'd be something I could put in the web.config which would say "For any request not already redirected via <location>, redirect it to "http:// domain.com". Even if this meant appending something to the web.config already in each folder, it would save days of work, say if no locations match, then redirect.
I've searched for having multiple locations or wildcards in <location> blocks but doesn't seem possible so I'm not sure what do do here—any help appreciated!
Suggestion: why not you redirect your 404 page to home page of any other you wish to.. if someone lands to any old page that no longer exists should go to 404 so redirect 404 to homepage, common practice in case of ecommerce sites they redirect their discontinued product page to search page. If that helps you can google "redirect 404 to homepage wordpress" there are lots of plugins that would do it, but as IIS you can simply config your web.config.
If the urls are now dead and you dont have replacement content to redirect them to, then the proper response would be to return a 404/410. Redirecting dead urls in bulk to the homepage will be seen by Google as a soft 404. https://support.google.com/webmasters/answer/181708?hl=en

Magento SEO URL's suddenly changed, can't reenable

I’m fairly new to the Magento platform but I have a decent amount of experience in web development on apache servers.
A few days ago I was asked to look into an issue that was first made aware of with failing filters.
I had a look at the google analytics data and it seems the SEO friendly URLs have all stopped displaying. The navigation URLs still use friendly words however on the page return the URL is redirected to a basic catalog URL.
http://www.camera-camera.com/cameras-and-accessories.html
instead now it goes to
https://www.camera-camera.com/index.php/catalog/category/view/id/9
I checked the admin config. The Web > SEO URL rewrites are set to YES
I toggled them to No saved and back to yes then saved. Tried clearing the catalog URL rewrite cache
Checked the htaccess file and it hasn’t been touched for months.
Emptied the core rewrite table and reindexed it.
So I’m outta ideas now, was hoping some of you more experienced users can have some input as to what else I can check.
I also found it strange that the URL is now ignoring postback parameters. If you look at their filters they are simply an a link to the same page with a post parameter. This gets striped and ignored now might be related?
A file restore was on the day it happened. Any files I should check it against?
Thanks for any help you can provide !
I just discovered that it was related to HTTPS. I didn't notice but seems the site keeps redirecting to HTTPS even though the filter links etc are pointing to HTTP, in the redirect the parameters are dropped. Now to figure out why its going into HTTPS

.htaccess file - forward everything, but not?

First time user, been looking all night.
We recently changed our site from .net to wordpress. We transferred over half of the news articles and not the other half. So now we get old users coming to the site and getting a 404.
The news articles that exist in the wordpress site have been reditected and work fine, for example,
www.example.com/news/transfered-news-story.aspx
redirects to
www.example.com/blog/news/transfered-news-story
this was done manually.
What I need help with is if someone comes to the site with any other request, e.g.
www.example.com/news/this-didnt-get-moved.aspx
or
www,example.com/news/anything-else
or
www.example.com/news/2010/02
all just gets redirected to
www.example.com/blog/news
I have been reading on and off for a couple of weeks and tried a few things but they all append the additional stuff on the end of the redirected string.
so www.example.com/news/my-stuff-ok
becomes www.example.com/blog/news/my-stuff-ok (and I want to drop the my-stuff-ok)
I hope you get what I'm after, any help would be very much appreciated.
Thanks
Phil
You can simply write a directive that converts a 404 to a url (documentation):
ErrorDocument 404 /blog/news
However, you really should go through the motions of adding manual redirects (permanent redirect) to the new url for each of the other articles because you will take a considerable SEO hit if those urls no longer serve up the content that was linked by the search engine.

HTTP Module causing problem with Google Cache

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.

Resources