I have a site at say www.example.com and also have two staging platforms at beta.example.com and preview.example.com and I need a way to set different robots.txt for each using IIS or something similar
The reason for this is that I want to disallow spiders on all but the www domain as they are spidering duplicated content
Anyone know if this is possible?
Is there a reason you can't just have 3 different robots.txt files, one for each host?
If you need to handle this automatically, I would suggest a HTTPHandler that handles requests for robots.txt. If the Request.Url.Host is www.example.com, return robots.allow.txt, if not, return robots.deny.txt.
If you are interested in this idea and need some example code to get you started, let me know.
Related
I'm after a little advice. I have a few websites which all essentially serve the same content. I have say websiteA, websiteB and websiteC. Each one points to one database to serve the content (think of it as a dating website). Each website has a folder in wwwroot and is mapped to the relevant domain name.
What I'd like to be able to do is have one website, say website A and simply point each of the domain names to that one site. However, how would I then make each site look different? Do I need something within websiteA which say if the referring URL is websiteB.com - serve this style sheet... if the website referring is WebsiteC.com then serve this CSS.
I suppose it's like creating a whitelabel service? I just don't know where I'd start!
Many thanks.
(PS: We have a windows dedicated server with IIS7)
The easiest option would be to react to the HTTP_HOST header, which will tell you which website the request if for, even if they're all mapped to the same folder.
The situation is the following: I created a site with Plone, developed, used, but behind a test URL. Now it has to be published, but the test URL is not appropriate and I don't want to move the site. I think, if I use a redirect, it won't be appear in the URL-bar, only in the case of site start page. Am I wrong? (The test URL should not be used, because it will be a "semi-official" site.) What do you suggest to do?
As far as I can see Plone uses absolute URLs everywhere. I can add relative URLs, but if I create a new page, a new event, etc., then they have absolute URLs on other automatically generated inner pages. Is there any way to convert these URLs to relative paths? Is there any setting possibilty where only a checkbox changes this default setting?
Plone does not store your URLs in the database. It uses the inbound host header (and any virtual hosting configuration set up with rewrite rules in Apache or Nginx) to calculate the correct absolute URL when rendering the page.
In other words - as soon as you actually point the relevant domain name to the server with your Plone instance, it'll just work.
P.S.
You should put a bit more effort into asking your question. This is just a copy and paste of a half-finished email chain where you tried to get the answer from me in private. It's not very easy to understand what you're asking.
I think what you are looking for is url rewriting to handle virtual hosting. ie to get your site to appear as if it's the root url of a domain.
This is normally done via the webserver that normally sits in front of plone. For apache, here is a howto
http://plone.org/documentation/kb/plone-apache/virtualhost
for other servers
http://plone.org/documentation/manual/plone-community-developer-documentation/hosting
You can also achieve this directly in zope (via ZMI) using something called the Virtual Host
Monster. see http://docs.zope.org/zope2/zope2book/VirtualHosting.html
PS. I don't think your question is badly worded. Plone does serve pages with a "base" tag and what appears to be absolute urls. They aren't baked into the database but it's also not obvious that the solution to getting the url you want is the VHM url syntax and a proxying frontend webserver. There is a reason why it doesn't use relative urls... which I can't remember it was so long ago.
My goal is to implement the following scheme using the subdomain and path as attributes:
Use a wildcard DNS entry that routes any subdomain to the root site:
Example:
*.example.com
ex: http://xyz.example.com
to
http://example.com
Next I want to rewrite the requests to point to a specific page, passing both the subdomain and the request path as attributes.
Example:
http://xyz123.example.com/images/header.jpg
to
http://example.com/get.aspx?id=xyz123&path=/images/header.jpg
I've seen several questions on here regarding similar goals, but not quite the same. I'm new to using rewrite rules, so any help is appreciated. I will update this as I make progress.
for IIS7, url rewrite functionality is built-in. Rules are set in web.config. For IIS6 you need an ISAPI dll that does the same for you. Use IIRF, it works just fine.
I have a direcory for the members area.
All the files within that directory should be treated by https.
All other files outside the specific dir should be treated by http.
How can i automate the redirecting from http and https and vice versa?
Btw, the links are relative.
You can use the SecureWebPages assembly and web.config entries from Switching Between HTTP and HTTPS Automatically: Version 2. It's a nice piece of kit, I've used it in the past to automatically switch login and admin pages to https
Best thing I can think of to cover humans would be to rewrite the urls using javascript. If they are all relative then it shouldn't be too tricky.
I'd note that mixing sites like this have some drawbacks, principally browsers don't like HTTPS pages with insecure HTTP requests involved. A better plan might be to make everything relative and only kick over to https mode once you need to hit the https section.
I can see a few ways to do this using IIS, but those options really depend on how much you can muck with the IIS configuration and what sorts of resources you have.
This sounds like it might best be managed through HTTP server configuration. E.g. mod_rewrite and similar.
Try asking on https://serverfault.com/
We are thinking of renaming our web directory schema to be more user friendly. However, we need any URL requests for the old directory structure to forward to the new one. so....
How do I forward requests for all of these:
http://mydomain.com/OLDdirname/
http://mydomain.com/OLDdirname/samesubdir/
http://mydomain.com/OLDdirname/samesubdir/samescript.aspx
to each of these respectively:
http://mydomain.com/NEWdirname/
http://mydomain.com/NEWdirname/samesubdir/
http://mydomain.com/NEWdirname/samesubdir/samescript.aspx
Any suggestions and perhaps some general guidance as far as gotchas?
You can use a number of things to do something like this. Basically, you're doing URL Rewriting. One of these products should help you get the job done:
ISAPI Rewrite
IIS Rewrite
opURL
IIRF
I use IIRF on many of my websites, and it has always worked without failing. You use regular expressions to define the rules, and it takes care of the rest. It would be extremely easy to setup a few redirects using IIRF.
http://cheeso.members.winisp.net/IIRF.aspx