301 URL Redirect with arguments without htaccess or php - redirect

How do I redirect http://olddomain.com/page to http://newdomain.com/page
The old domain is using namecheap's dns. Currently, I have setup a 301 URL redirect on olddomain.com and www.olddomain.com to www.newdomain.com. However, visiting olddomain.com/page takes me to www.newdomain.com instead of www.newdomain.com/page.
Is there a way to do it without using htaccess or php?

use webmaster tool. Thats is easy. We normaly use server side programming, ip redirect. But that is very easy and convenient.

Related

HAProxy 1.5 URL/URI Redirects to a different domain

I'm looking for a method to redirect visitors from https://site1.co.uk to https://site2.co.uk in HAProxy. I also need to redirect sub-pages (i.e. https://site1.co.uk/page1) to similar pages on site2.co.uk but using specific URLs. I have stuck a sample below of what I'd like to achieve if that helps...
Home redirect:
https://site1.co.uk -> https://site2.co.uk
Sub redirect:
https://site1.co.uk/first-page.html -> https://site2.co.uk/about-us.html
I've been searching for the last day or so for a simple solution to this problem and have been unable to find anything that does the trick.
I'm using HAProxy 1.5 (version required for a specific project) and any help would be much appreciated!
UPDATE
Things I've tried...had to remove HTTPS www.'s due to account limit.
redirect prefix site2.org.uk/subpage2/endresult2.html if { hdr(host) -i site1.org.uk }
redirect prefix site2.org.uk/subpage2/endresult2.html if { hdr(host) -i site1.org.uk/site1page.html }
Line 1: redirects correctly.
Line 2: End result is site2.org.uk/subpage2/endresult2/site1page.html - this is incorrect and should not include the site1page.html page on the end.
End result should be site2.org.uk/subpage2/endresult2 - this is how it I would like it to appear.
The server that HAProxy is on also serves multiple sites with different URLs. The above code is also redirecting them yet it shouldn't interact. How can I prevent this from happening?
UPDATE 2
I've noticed that when I enable a redirect, it's affecting my other sites which route through HAProxy and not just the one I'm trying to redirect (i.e. site1)
if you need to redirect your URL, you can check below link:
How to redirect URL with HAProxy
in haproxy you should use configuration like above
Although not technically the answer I wanted...I realised that I could redirect using the httpd configuration file instead of HAProxy. In the end that was the easiest option for a newbie like myself. Time will tell if this performs well...

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.

server side redirect in classic ASP on IIS7

I'm trying to implement a simple 301 redirect from mydomain.com/page1.asp to mydomain.com/page2.asp. These are dynamically generated product pages of an ecommerce store, so they don't physically exist as files.
In Apache it's simple to do with .htaccess but all I found are ways to redirect static pages, that actually exist on the server, such as placing the code below in at the top of the existent file:
<%#LANGUAGE="VBSCRIPT"%>
<%
' Redirect to the new location with the correct 301 Moved Permanently status
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "http://www.example.com/new-page.php"
%>
Is there a way to redirect a dynamically generated page in IIS7 using classic asp?
UPDATE
Based on the comments received, I need an URL rewrite module. #ZippyV suggested this one
You want to rewrite your URL requests instead of redirecting them.
IIS has a URL Rewrite module which you can download here. Another nice feature is that it can transform your outgoing html too.
More articles on how to use the IIS URL Rewrite Module: http://www.iis.net/learn/extensions/url-rewrite-module

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!

Resolve Proper URL

How can I turn domain.com into https://www.domain.com (the actual address)? Is there an easy API for this?
The purpose is to allow a user to enter a domain in preferences and allow my app to convert that into a fully qualified web URL like a web browser does when I type google.com it returns http://www.google.com (ish).
If typing your domain.com results in https://www.your domain.com then the server is redirecting. Here is a rule to follow:
Construct "https://domain the user typed". Connect to that, and follow any 301 (permanent) redirects until you get a 200 response. Save the URL you end up at as the permanent one.
If your connection failed, try again with http:// instead of https://.
Do not assume that the "proper" URL contains "www."; if it should, then the server will redirect.
What's so hard about putting "http://www." in front?
How does that require an API?
Are you asking about the string concatenation API?
Use the NSURL class. More specifically, use initWithScheme:host:path where scheme is "http", host is your string and path is empty.