301 Redirect w/ Parameters IIS web.config - redirect

I made an error in structuring my clients site such that I unnecessarily added a path that was not needed.
What I did was this:
www.mysite.com/vehicles/ford
www.mysite.com/vehicles/ford/fusion
I have since modified the site such that it now reads -
www.mysite.com/ford/
www.mysite.com/ford/fusion/
Needless to say that Google is now reporting well over 1600 bad urls, ie. 404.
I am using Godaddy shared hosting IIS, the site is done in classic ASP.
I have the web.config file figured out for the url rewrites on the second generation but am hoping to get some help with the 301 redirect. I hope I don't need 1600 redirects, but rather some code that takes anything with /vehicles/ (and after) and redirects to another page, say the home page.
Here is what I have tried but it just takes me to /vehicles/acura/

Related

Coldfusion - Redirect website if it hits /folder/index.cfm?

Very new to Coldfusion, but not to web development so hopefully this is an easy question.
We recently changed a link on our website that took us to /folder/index.cfm. I want to make sure that when someone types www.ourwebsite.com/folder that it doesn't take them to /folder/index.cfm and instead to redirect them to another website.
Any pointers?
There are at least three ways it to do this.
Don't even bother with ColdFusion. Have your web server do the redirect. You are going to need to know if it Apache or IIS or whatever. You can then search for how that web server does it.
This might help you with some of that: Custom 404 error page not working on IIS 8.5
You can make a file at /folder/index.cfm and have a file that has
OR with cfscript
<cfscript>
location("newpage.cfm", false, 301)
</cfscript>
Note the addtoken and statuscode are optional. Add token helps because almost no CF website uses this kind of token. The status code helps because tells the browser that this is a permanent move.
You could intercept the request in application.cfc . In fact, in some systems all requested are checked for validity in application.cfc. You might still need a blank page at the target, but at least some ColdFusion is processed
Of all the options, 1 is my favorite, because there really isn't a lot that can be done with requests to missing pages. And the list of potential missing pages is unlimited.

Will doing 301 to url that did 301 the other way around some time earlier would cause trouble?

On a site we have a tag system. Recently we discovered that we have to rename most of the tags and redirect them. It looks like a job for 301 redirect, however some of the tags will be renamed incorrectly (because the process is automatic) and we will return them to their original name at a later time. When that happens we will need to do a redirect back to the original url and probably do a 301 again. Obviously at one time only one of the urls would do a 301 and all of this would happen within the same domain.
For example, we start with www.example.com/tag/foo.
Then the automatic name correction would change it to www.example.com/tag/bar and do a 301 from the previous address.
The automatic correction would be ok for most tags, but not this one, so we would eventually fix the url back to www.example.com/tag/foo and do a 301 yet again.
I tested it (using a site running locally) in Firefox 50 and Chrome 54 and both seem to handle the situation fine (when I redirect to the original address the browser forgets the old 301). Does google (and/or other browsers) also figure this out or am I better of doing 302 and hoping that google changes the address in the index rather than duplicate the pages?
You're using 301 Moved Permanently for what you admit in the comments is a 307 Temporary Redirect. So yes, that causes problems.

Adding more than 1000 301 redirects in drupal site

I am using drupal 6.
I worked on the site revamp for one of our clients and we needed to redirect the old site urls to relevant new site urls so that we do not loose the traffic. I have used path redirect module for same and added some of the urls.
The issue is we have more than 1000 urls to be added and there is no specific pattern (as old site was in asp.) so it would be 1 to 1 mapping for redirect. Adding it in url alias table via path redirect module is something which is hitting the site performance and again it is a manual process.
Is there any other better and optimal solution for this scenerio?
http://drupal.org/project/path_redirect_import
This module has import feature out of the box.
I'm interpreting this question as a question of performance (not a question of the ease of populating many redirects). Please correct me if I've misunderstood your question.
Put redirects in .htaccess
If you're using Apache, then your alternative is to put the redirects directly into your .htaccess configurations. There should be a similar configuration option for this for IIS as well.
This still means that you would have to create the 1 to 1 mapping for each redirect you want, but the redirects are not stored in your database so it saves hits to the db.
Advantages to using Path Redirect module
Note that the Path Redirect module can log when a redirect was last accessed. This statistic/tracking can help you remove redirects that are no longer in use in the long run.
There are posts on the Path Redirect issue queue that suggest that 1000 redirects should not be a problem but every setup is different. You will need to perform your own benchmarking to check the performance of your particular site.

301 Redirect appears to be losing referrer information

We've just put a new website live and I have varying Url re-writing in place to handle the old indexed pages, performing a 301 redirect to the new equivalent page location on the new site.
We've noticed since the day the new site went live that in Google Analytics, the stats in general have plummeted substantially :(
One of our SEO guys has pointed out that when you click on one of the old indexed pages in google, it correctly 301's to the new location, however, if you view the __utmz Google Analytics cookie, it has 'direct' in it, whereas he believes that should be 'organic'.
He thinks that the referrer information is being lost during the 301 redirect, and as a result, this is being treated as direct traffic instead of organic?
The new website is an ASP.NET 4.0 Web Forms application and is using Routing for the new Url's. I am generating the new route/url for old pages within the global.asax within the Application_BeginRequest routine.
If a 301 is needed for the request, this is the code that is executed:
Response.Clear();
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", newUrl);
Response.End();
Is there anything here that would indicate what the problem might be, or any ideas beyond the above what might be causing such an issue?
I located the problem - a silly error on my part with a relative url to a file that accompanies our google analytics tag, working in some locations of the website, but in others, the include was returning a 404! My bad.

Will redirecting a bunch of old dynamic URLs to a single new index page totally bone my pagerank?

I've got half a dozen legacy dynamic URLs and it turns out redirecting them all will require 18 Rewrite directives in my .htaccess file - that seems messy to me.
What I can do however, is redirect all of them to my new start page with a single Redirect directive. It's a tiny site and all the pages people might come in from via google searches are really easily findable from the start page so I'd like to do that however...
I'm worried this might kill the site's modest (but worth maintaining) page rank as several URLs would then be resolving to the same URL and content.
Does anyone know if this would be the case, and if so, if there are strategies to avoid that other then not implementing the above?
Thanks!
Roger.
As long as you do 301 Redirects (permanently moved) vs 302 Redirects (temporarily moved), then all the accumulated page rank from your dozen legacy URLs will transfer to the new url you are redirecting to.
So you will not "lose" the pagerank, it will simply be transfered over to the new URL.
The important thing is to ensure it's a 301 Redirect.