Redirect 301 Not Working Fine - redirect

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.

Related

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

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.

Redirect haproxy from url to another keeping this same path/uri

I want to redirect as the below examples, keep the same path/uri but change the url.
https://test1.com/example1/example2 --> https://test2.com/example1/example2
I managed to do it for the url only by creating an acl acl_name base url and then do a redirect code 301 with an if conidtion.
Thanks,

How to fix Redirect 301 problem with multiple subdirectory

I have many redirection with my .htaccess.
Some of my url works fine but others not working.
Many of my url are broken and give this result :
I try this :
Redirect 301 https://mywebsite.com/old-directory/old-directory/old-content https://mywebsite.com/new-directory/new-directory/new-content
And the url give me a 404 error with this url : https://mywebsite.com/new-directory/new-directory/old-content
it's like the redirection is not finished.

How to use URL Rewrite before HTTP Redirect on IIS

So I have a website running on IIS on an address like this: myserver.com/mysite.
From here I made a rule to redirect the site to: myserver.com/mysite/path/to/file.
I did this using the HTTP redirection module to make a 302 redirect to path/to/file and that works fine.
The problem is that if I dont put the trailing slash / at the end of mysite I get a 404 error, so I used the built-in template AddTrailingSlashRule in the URL Rewrite module.
So if I disable the redirect, the trailing slash gets added at the end of the website just fine, but once I enable the HTTP redirect, it sends me to myserver.com/path/to/file/ and obviously that doesn't work, because I get the redirect first and then the rewrite.
Is there a way to change the "order" of the modules? Or is there a better way to achieve this?
Thanks for any help!
For anyone having this problem in the future, I ended up disabling the HTTP redirect and made a new rule using the URL Rewrite module.
It simply matches the ^$ regex and then redirects to path/to/file.
That rule goes after the trailing slash one so with or without the slash, it gets added and only then it gets redirected.

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!