If there is an IIS between the website and the server, 301 redirected requests lose the query string - redirect

There is a website and a server. If the website access the server directly, everything works.
The website asks for .../jobs?limit=50.
It gets a 301 and is redirected to .../jobs/?limit=50
And Success!
Now we add a IIS in between the two. The IIS does URL rewrite.
The website asks for
.../jobs?limit=50.
Gets again a 301 BUT it is now redirected to .../jobs/ only.
The querystring is lost. It is missing at the "location" parameter in the response header of the 301 response.
The rewrite rule is set up with the pattern ^(abc.*) and rewrite URL is http://localhost:1234/{R:1}. Append query string is checked.

Related

query database before 301 redirect PHP

I have some dynamic URLs that need 301 redirects. Some of the new paths are stored in mysql. So for instance,
index.php/comp/?view=product&id=50
will now redirect to
product/?view=product&id=50
Or depending on the id it could be
product/bags/?view=product&id=100
There is not enough info in the URL to perform a GET request to get the correct path.
Can I do a database query before doing
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.example.com'.$newpath);
There are thousands of these URLs and I don't want to have to resort to generating thousands of redirect via htaccess.

Response.Redirect() vs Response.RedirectPermanent()

I am new to ASP.Net 4.0, and have seen a new feature called Response.RedirectPermanent(). I have checked a few articles, but I'm unable to understand clearly the actual meaning and difference of Response.RedirectPermanent() over Response.Redirect().
According to Gunnar Peipman,
Response.Redirect() returns 302 to browser meaning that asked resource is temporarily moved to other location. Permanent redirect means that browser gets 301 as response from server. In this case browser doesn’t ask the same resource from old URL anymore – it uses URL given by Location header.
Why do I need to check the server response such as 301, 302? And how does it get permanently redirected the page to the server?
301 response (RedirectPermanent) is very useful for SEO purposes. For example, you had a site implemented in ASP.NET WebForms and redesigned using ASP.NET MVC. You'd like to inform search engines that page /Catalog/ProductName.aspx becomes /products/product-name. Then you set 301 redirect from /Catalog/ProductName.aspx to /products/product-name and links in search engines' indices will be replaced. 302 (Redirect) is mostly for internal purposes. For example, the redirect after login (if returnUrl was set in URL).

Site Performance: rel=canonical vs redirect 301

From this page on the blog of Matt Cutts, he says that rel=canonical should be a secondary choice if you can't use a 301 redirect. Is there any performance issue with using a 301 redirect instead of a rel=canonical?
In my experience, the performance difference is negligible. There are more steps involved in the implementation of 301 redirects, so rel=canonical might perform slightly better. The extra steps are typically executed very quickly and should not add any noticeable delay or strain on server resources.
rel=canonical
User makes a request for /non-canonical.html
Server looks up canonical URL: /canonical.html
Server builds a page that includes the canonical tag and sends it to the user
301 Redirect
User makes a request for /non-canonical.html
Server looks up canonical URL: /canonical.html
Server issues a 301 redirect to the canonical URL.
User's browser automatically makes a second request for /canonical.html
Server discovers that this request is for a canonical URL.
Server builds a page and sends it to the user.

Redirect 301 Not Working Fine

I'm trying to do a simple Redirect 301 but I'm experiencing an issue in this case:
This is my redirect:
Redirect 301 /negocios/wisconsin/wi/ www.domain.com/directorio/category/121/Wisconsin.html
When I enter this URL:
www.domain.com/negocios/wisconsin/wi/servicios-multiples/
It applies the Redirect rule and sends the browser to this URL:
www.domain.com/directorio/category/121/Wisconsin.htmlservicios-multiples/
Which is a WRONG url. Probably because a part of the URL (/negocios/wisconsin/wi/) is similar to the URL I'm trying to redirect.
How I can do to apply the Redirect ONLY to this URL (/negocios/wisconsin/wi/) even if I enter another URL similar like for example
www.domain.com/negocios/wisconsin/wi/WHATEVER-HERE
Try using a RedirectMatch instead:
RedirectMatch 301 ^/negocios/wisconsin/wi/$ www.domain.com/directorio/category/121/Wisconsin.html
This tells apache only to redirect on the exact match instead of linking path nodes together, which is what Redirect does.

IIS 7.5 URL Rewrite Module & Redirects

My company is embarking on a large website redirection at the moment and I decided it would give us the perfect opportunity to make the URL's more user and google friendly.
To give you a brief outline of the situation, I am the SEO guy and I am dealing with an external developer in order to redirect the website without hurting the current rankings in Google. I don't have much experience regarding sharepoint hence why I would really appreciate any assistance in understanding and knowing if there is a work around to my situation.
The website is using IIS7.5, they recently installed the URL Rewrite Module in order to create more user friendly URL's. My question is, by creating a more user friendly URL, does this cause an additional redirect?
For example: if a user types in www.domain.com this permanently (301) redirects to www.domain.com/pages/home.aspx.The developer told me that in order to rewrite the URL to display something more friendly (like www.domain.com/home) this will have to cause another permanent redirect. So in essence the process will look like this:
REQUESTING: http:// www.domain.com
SERVER RESPONSE: HTTP /1.1 301 Redirect
1) Redirecting to: http:// www.domain.com/pages/home.aspx
SERVER RESPONSE: HTTP /1.1 301 Redirect
2) Redirecting to: http:// www.domain.com/home
SERVER RESPONSE: HTTP/1.1 200 OK
Is this how the URL Rewrite Module really works? I would have thought that it would not have to create another redirect in order to create a more user friendly URL?
My second problem is this.... The redirect is happening on the same server. So here is essentially the situation:
www.old-domain.com
www.dev-domain.com
www.new-domain.com
The old-domain needs to be redirected to the new domain so we ran a test in order to see if the HTTP status codes were correct before going ahead with the project. So the developer redirected the dev-domain to the new-domain and the redirects look like this: (The developers comments in italic below)
REQUESTING: http:// www.dev-domain.com
SERVER RESPONSE: HTTP/1.1 301 Moved Permanently
1) Redirecting to: http:// www.new-domain.com/
SERVER RESPONSE: HTTP/1.1 302 Redirect
2) Redirecting to: http:// www.dev-domain.com/Pages/home.aspx
SharePoint’s alternate access mappings causes this to happen and there is no way around this.
SERVER RESPONSE: HTTP/1.1 301 Moved Permanently
3) Redirecting to: http:// www.dev-domain.com/pages/home.aspx
SERVER RESPONSE: HTTP/1.1 301 Moved Permanently
4) Redirecting to: http:// www.new-domin.com/pages/home.aspx
SERVER RESPONSE: HTTP/1.1 200 OK
The developer states the reason for redirecting back to the dev-domain then back to the new-domain is because of SharePoint's alternate access mappings and there is no way around this. Is that entirely true?
Any assitance at all will be GREATLY appreciated!