Orchard multi tenant with multiple hostnames - orchardcms

Is it possible to have multiple hostnames pointing to the same tenant. E.g. I want my-website.nl and mywebsite.nl pointing to the same instance.

That would be bad for SEO. You should pick one and have the others permanently redirect to it.
UPDATE: to redirect, you can use IIS url rewrite by editing the web.config, or you can use the Rewrite module for Orchard: http://gallery.orchardproject.net/List/Modules/Orchard.Module.Contrib.RewriteRules
Although I don't recommend it, you can also specify a comma-separated list of host names in tenant configuration and get the result you wanted initially (I should have remembered that as I wrote that code).

Related

Azure SWA: redirect to modified version of requested route?

I set up a site using Azure Static Web Apps. I have two use cases I haven't been able to solve nicely for, and I think the same functionality might address both:
When a user is not authenticated, they're redirected to <my-site>/.auth/login/<my-auth-provider>. But, that means when they're brought back after logging in, they go to /index.html, which is not ideal. Most of the traffic to this site will be to specific leaf pages. I'd like to redirect to <my-site>/.auth/login/<my-auth-provider>?fromUrl=<the-requested-url> instead, if possible.
When a user requests a "pretty" url address e.g. <my-site>/pretty-url, I noticed that Azure SWA doesn't handle that the normal way, rewriting to <my-site>/pretty-url/index.html. I'd like it to at least try to rewrite to <my-site>/pretty-url/index.html.
It looks like neither of these are possible at the moment.
Here's a Github issue about redirecting after login, and one about enforcing trailing slashes.

How to prefix all requests with ~username?

I'm testing moving my site to a new Linux server using cPanel which requires you to put in your IP and username (e.g. http://123.xxx.xxx.xxx/~username/). The problem is, all my image/JS/CSS links use paths like /css/style.css or /images/picture.jpg so none of the styles, scripts or images show up properly.
How do I set up a RewriteRule to prefix ~username to all requests?
Before moving site, if it was working with only domain name and with redirection then now it should also work with server IP and username, Make sure the permissions and ownership of /css/style.css or /images/picture.jpg are correct.
Also check it once adding exact path manually like 'http://123.xxx.xxx.xxx/~username/css/style.css'.
I was able to get around the issue by setting the domain to a dedicated IP instead of shared, so I could access the site using 123.xxx.xxx.xxx instead of 123.xxx.xxx.xxx/~username.

Orchard how to make homepage address also accessible by index

Supposed my home page at the moment is: www.myorchard.com
How do I make it when user access www.myorchard.com/index also goes to home page?
You don't want that. For good SEO, a resource should always correspond to one URL. What you want to do is redirect from one to the other, permanently. You can do that either using IIS's rewrite URL module, or through this Orchard module: http://gallery.orchardproject.net/List/Modules/Orchard.Module.Contrib.RewriteRules
The former solution is to be preferred for less overhead, but if you think you're going to have to manage lots of rewrites often, the latter is more convenient.

Using URL Rewrites to allow 1 IP address to host two subdomains

I have a scenario where I need to two different subdomains to come through the firewall and be rewritten or redirected to areas on the server. For example if I have sub1.mydomain.com/testsub1.html entered externally, I want it to hit the IIS "Default web site/folders/sub1/testsub1.html" and likewise, if sub2.mydomain.com/testsub2.html is received I want it to go to "Default web site/folders/sub2/testsub2.html". We were told that URL Rewritew would be the way to go on this. So we set up rules in the Default web site, to use the MatchURL pattern for:
1. sub1.mydomain.com(.) and to rewrite it to "Default web site/folders/sub1(R:1)" with the action type of Rewrite.
2. sub2.mydomain.com(.) and to rewrite it to "Default web site/folders/sub2(R:1)" with the action type of Rewrite.
If I hit http://sub1.mydomain.com/testsub1.html, I get a file not found error. What I am seeing in the logs is the GET /testsub1.html. If I change the URL to http://sub1.mydomain.com/folders/sub1/testsub1.html, it works perfectly and I see GET /folders/sub1/testsub1.html in the logs and the proper page is displayed in the browser.
What am I missing to make this work without the full path?
Bindings are the best way to handle this. They can listen on the same IP address for different hostnames. Create two separate websites in IIS and configure each of their bindings for that particular subdomain.
More information: http://blogs.technet.com/b/chrad/archive/2010/01/24/understanding-iis-bindings-websites-virtual-directories-and-lastly-application-pools.aspx

Transferring Everything from One Domain to Another

I want to move from one domain to another one that is shorter and (hopefully) easier to remember, but I also want the transition to be as seamless as possible.
I'm a coder so I know about 301 redirects and I intend to use them, but is there something easier than manually adding entries in my .htaccess file?
The website is static with the exception of the blog, which is under the /blog/ directory and powered by WordPress. I want it redirected to my new domain name. File and folder structures don't change. Isn't there some kind of wildcard thing for this?
What type of web server is the site being hosted on? If its on Apache, you can use the RedirectMatch command
Why not leave the web site unchanged, and [temporailly] let the both the old and the new domains assume the IP of the site, at the level of DNS ?
In other words.
Let the DNS setup for the existing domain as-is (for now)
have the DNS of the new domain assingn the particular server name to the IP of the web server (or preferablly to a 2nd IP, also assigned to this very site).
In a few months / whenever the old domain is soon to expire, check what residual traffic may still be using the old domain name (Old IP), and for them only, add a small piece of text somewhere in the UI to inform them of the new domain.

Resources