I've installed IIS 7.0 with SharePoint and Url Rewrite module.
Are the following sentences or perhaps I have configured something incorrectly to see this result?
Url Redirect can redirect a url to any internal (on the same site) or external urls (on a separate site).
Url Rewrite can only rewrite to an internal url?
Many thanks in advance.
Url Rewrite can redirect a url to any internal (on the same site) or external urls (on a separate site).
You can actually rewrite to a different server (so your domain displays content loaded from an external site) using ARR (Application Request Routing) with reverse proxy rules. Here's a step by step guide on how to do it and keep your relative paths working:
http://blogs.iis.net/carlosag/setting-up-a-reverse-proxy-using-iis-url-rewrite-and-arr
Related
Using the regular cl_image_tag(carrierwave_object) will always produce an http://cloudinary-url URL, which fails to load on most browsers if they connected to the website through https. Is it possible to make cloudinary serve URLs such as //cloudinary-url so that the browser can choose the protocol itself, without finding every single cl_image_tag call and changing it manually?
Note that I'm using the cloudinary_rb gem with Rails 3.2.x
Thanks!
You can use cloudinary over https
That wouldn't be a problem for non-https users of your site cause there's no security warning in that direction...
You could create a helper that would take a url and generate an http or https url depending on what case you are. You can always know in your views / helpers if you are on http or https from your request object.
Say I have a domain name bound to my site. The domain name is www.example.com
Normally, it will be easy to rewrite the URL from www.example.com/foo to www.example.com/bar.
However, I would like to rewrite www.example.com into www.foobar.com, is this rewrite possible?
Notice I'm talking about "Rewrite" not "Redirect". Using redirect, the URL will be translated into www.foobar.com after page loads. In my case, I would like it to go to www.foorbar.com but still have www.example.com as the web URL in the address bar for the browser.
I'm probably asking too much, yet I really don't know how far we could go in techniques these days.
By the way I'm using IIS 7
Rewrite? No. You can set multiple domain names to go to the same place, but this would be with your domain host, not an IIS setting. If you could arbitrarily rewrite URLs, think of all the security problems that would arise.
Yes if foobar.com is also a website you own in your network. It's the reverse proxy feature of URL rewrite:
http://weblogs.asp.net/owscott/archive/2013/10/24/creating-a-reverse-proxy-with-url-rewrite-for-iis.aspx
I have a website hosted on 000webhost and a paid domain was purchased from 1and1. 1and1 offers URL redirecting with HTTP or frame redirect, but I have opted to point the paid domain to 000webhosts name servers.
Currently this works to the point that when I type the paid domain in (www.paiddomain.co.uk), it points me to the correct website (www.freedomain.com). Once on this page any page that is clicked shows up in the address bar as www.freedomain.com/link when what I want is for it to show up as www.paiddomain.com/link.
What's the best way of doing this?
Terminology
origin server - the server that provides the original content
proxy server - the server that sits in the middle between the client and the origin server
In your case the origin server is freedomain.com. It sounds like you opted out of a proxy server and just have the DNS pointing to the origin server.
Reason
The first page loads fine because it is accessible by two domains. However the HTML content that was delivered has absolute links to the origin server. Therefor when the client clicks on it they are taken directly to the origin server.
Without a proxy server you have two choices
Get the origin server to generate absolute links to the domain you want.
Get the origin server to generate relative links.
This depends on how your pages are generated (static html, drupal, wordpress, custom app). But the net effect is that your links will be generated like this:
absolute URL
or like this:
relative URL
If your site uses cookies you will also need to figure generate them for the correct domain.
For systems that generate an absolute URL they will usually have a variable that stores the "site url", "base url", or similar either in their configuration or in the database.
With a proxy server
You can ask your proxy server to translate links (and cookies, etc) from freedomain.com to paiddomain.com. This depends on the proxy server, in apache you would use ProxyPassReverse.
1and1 is apparently not willing to be your proxy server:
http://faq.1and1.com/domains/domain_admin/domain_dest/3.html
They are willing to provide a frame (poor bookmarkability), or HTTP redirect (change the URL).
With a RedirectRule in the .htaccess file:
Example - Redirect from www.freedomain.com/link to www.paiddomain.com/link:
RewriteEngine On
RewriteCond %{HTTP_HOST} !www.freedomain.com/link$ [NC]
RewriteRule ^(.*)$ http://www.paiddomain.com/link/$1 [L,R=301]
More info
I was running in to this same problem when using the frame redirect offered by 1and1. My page had absolute URLs to an external site and when clicked they would load a blank page with my 1and1 domain in the title bar.
Chrome out put this error:
'absolute link to external site' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
Turns out when I clicked the links the browser was trying to open them in the frame 1and1 added to my page. The solution was to add the target attribute to my links and set it to _top. This causes the links to be opened fully in the current window/tab and ignore the frame.
I would like to fake mask URL to another url..
Example:
I have domain www.domain.tld..
And I want to mask it to www.google.com
So, if someone type www.domain.tld/something, it will load URL www.google.com/something - without redirect!
Is it possible? Both domains are mine.
I can use VHOSTS, or htaccess..
If both your domains are served by the same server, you can use an internal URL rewrite to do this. Apache would internally server the content from domain B when a request comes in for domain A. The mod_rewrite documentation has all the information. It's very powerful, so there are many options.
Using only DNS, how can I have http://www.example.com/ either redirect or resolve to http://www.anotherdomain.com/example ?
UPDATE:
Since it's been mentioned below that DNS cannot be used, what's the next best alternative (minimize load on server and provides the fastest redirect experience for the user) ?
You can't. DNS doesn't handle URLs, just maps names to IPs.
URLs aren't part of DNS, only domain names are.
Just as Tim Howland said, you can't. You need to use something like the URL rewrite module for Apache or a redirect page (both on example.com).