Skinning different micro-sites based on subdomain - plone

Plone 3.3.4
Version of collective.xdv from http://good-py.appspot.com/release/collective.xdv/1.0?plone=3.3.4
Summary
Looking for suggestions on how to use xdv to apply different skins to the same site, based on which URL was used in the request.
Text
Requirements
We need several micro-sites, each with its own skin and different from the main site.
The micro-sites shall have a subset of the content of the main site. Part of the main site content shall not be visible on the micro-sites, but this can be achieved by simply hiding links to those parts, both from navigation, sitemap, and portlets. It's ok if users find hidden content through URL-hacking. The HTML of micro-sites should be customizable.
Each micro-site shall be accessed through a subdomain of the main site.
i.e. let the main site be http://site.com, micro-sites will be at http://a.site.com, http://b.site.com, etc.
The client wants to be able to activate a new micro-site with no additional development, just some html, css and image files, and adding a virtualhost to apache config.
Possible Solutions
collective.xdv sounds great, but we have not been able to figure out how to have it pick a different theme.html file based on the URL. Most of the solutions out there seem to focus on creating sub-sites that are based on a subfolder of the Plone site. We do not want to have different content for the microsite, just a different skin (and some content hidden from navigation), so we don't want to create a new folder for each microsite.
A couple ideas we want to try are to a) customize the main template to have it add a different class to the html body for each subdomain, and then use xdv rules that look for that class, and b) to patch the publisher to do something based on subdomain.
Another approach would be to branch collective.xdv to modify its "alternate themes", so it would use the URL to select a theme.
Anything else we might have missed?
Thanks!

You should consider migrating to the last Plone 4.1 release. Using the new and shiny plone.app.theming (only available for Plone > 4.1) you can use theme parameters(consult the documentation here) inside your diazo (the former xdv) rules file like e.g. the $host variable (or whatever custom parameter you may want to set for your usecase - configurable via the plone.app.theming control panel). If you are stuck with Plone3.x/collective.xdv then your best option will be setting headers in your webserver, e.g (Nginx example).
location / {
...
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-XDV "true";
proxy_set_header X-Subsite "sub-a";
}
and accessing these from the request.

Related

What is the best practice to manage subdirectories in WordPress?

I have a website that is written use static html pages. It contains many URLs containing subdirectories like this:
https://www.example.com/product1/order.htm
https://www.example.com/product1/error/error1.htm
Now I want to create a new website via WordPress and transfer all contents from the old website to the new one.
So I wonder what is the best practice to process all these URLs with subfolders.
Should I:
Keep the subfolders by using parent/child pages, like this:
https://www.example.com/product1/order.htm -> https://www.example.com/product1/order/
https://www.example.com/product1/error/error1.htm -> https://www.example.com/product1/error/error1/
Or
Remove all subfolders, and chaning all URLs like this:
https://www.example.com/product1/order.htm -> https://www.example.com/product1-order/
https://www.example.com/product1/error/error1.htm -> https://www.example.com/product1-error-error1/
Or using other methods?
Thanks
Update:
With the hint of others, I get to know there are categories in WordPress. I search online and find the following URLs:
https://www.wpbeginner.com/wp-tutorials/seo-friendly-url-structure-for-wordpress/
https://www.wpbeginner.com/beginners-guide/categories-vs-tags-seo-best-practices-which-one-is-better/
So it seems using categories is a good practice to keep a hierarchy structure in WordPress. Is that correct?
Update 2
I have a question. In traiditional websites, for a product, normally the home page is https://www.example.com/product1/ , while the additonal pages such as https://www.example.com/product1/order.htm are put under the "product1" subfolder. Now in WordPress, their URLs should be:
URL1: https://www.example.com/product1/ ->(Unchanged) https://www.example.com/product1/
URL2: https://www.example.com/product1/order.htm -> https://www.example.com/product1/order/
In such a case, whether should I set product1 as a postname(for URL1) or a category(for URL2)?
Good...
The WordPress directory manager is something that until now I only saw in the media gallery ...
But if you want something, you can have control over the installation of Total WordPress ...
In addition to database errors and PHP for free ...
It offers a range of services like PHPMyAdmin, installing WordPress via a script, file manager, whatever you are looking for ... Logging errors and even how you set up email, spam, you can see what space on the disk hard drive and RAM what kind of CPU you are using.
Configure your localhost on your domain from your server ...
He's very complex, I mean, he's very complete.
It's Webmin if you are a basic user, now if you are a more advanced user ... I recommend Virtualmim these two implements that can be easily installed and also configured very quickly.
It offers a variety of attributes for you to have control of your WordPress.
But it also depends on your hosting ...
As they are installed via the command line / SSH, so if you don't have this option in your hosting, it gets a little more complex if you have VirtualMin or Webmin...
I would suggest looking into registering custom post types. You can program those, or use a plugin like CPT UI. You then get a custom link structure that is e.g. example.com/products/awesome-product. This would then be the 'detail' view.
I'm not sure if you have separate order and error pages, but that could be part of the permalink structure in Wordpress as well. You might even setup rewrites for the example.com/products/awesome-product/order and example.com/products/awesome-product/error parts to have a specific page loaded, or the detail view and then have a custom layout based on these url parts.
If you used the product ID's in the old site, you could also create a custom permalink structure have it like this: example.com/products/1. That way you could easily rewrite url's in .htaccess from the old site to the new using just one rewrite rule and regex for the id's
i think you more or less answered your own question. But to be clear based on experience.
Keep the subfolders by using parent/child pages, like this:
https://www.example.com/product1/order.htm -> https://www.example.com/product1/order/
install this plugin: 'WP 404 Auto Redirect to Similar Post' Automatically Redirect any 404 page to a Similar Post based on the Title, Post Type & Taxonomy using 301 Redirects!
It will find the updated pages / posts in a heartbeat.
Benefits are it will also deal with all 404s, and redirect them to simular pages which helps with SEO.
Its a lazy mans approach, as its one more plugin, but it works..

Moving from nginx to Netlify or Github pages

We plan to move our static websites from dedicated servers running nginx to Netlify / Github Pages.
Currently we run nginx as our web server. Nginx allows our content to be organised in flat hierarchy as shown below and let us map each URL to the file system path like. For example,
/web/main -> for https://example.com/
/web/docs -> for https://example.com/docs/
/web/jsapp -> for https://example.com/app/
As I understand from the Netlify / Github Pages documentation, we may need to reorganize our content in deep hierarchy like following (please correct me here):
/web/main
/web/main/docs
/web/main/jsapps
Is this a correct understanding? if yes, we would like to avoid that. I hope that Netlify / Github Pages will have something to organize the url and content path individually like nginx does but I couldn't find anything other than redirect (which is not what I am looking for).
Any idea?
Thanks
Yes. Correct. Most of it will come down to reorganizing your static website in a specific structure. You will have to make sure you have an index.html at the root. If you plan on using something like Jekyll or Hugo or even Gatsby, that could help with pipelining assets, building URLS, etc. but moving a compiled static site will need to follow a specific structure. In the end, github pages hosts that and not the engine.
If you leave anything on the nginx too, say css, then you will need server side push too. A lot of variables there. Small ones however. Restructuring is anyway the better way to do it, if it is all static content.

Woocommerce core changing external link protocol

I've got a Wordpress site in which I'm trying to add some external links to a footer widget. The site is ssl and I need the links to go to http sites. After putting these links in a text widget, they are being re-written on the front-end to be https.
I've isolated the problem to the Woocommerce core plugin, but I can't find any settings in the admin area (including the "Force SSL" setting) that fix it.
Does anyone know how to force the http protocol, or stop it from being changed to https? Ideally it wouldn't involve rewriting parts of WP or Woocommerce core.
Thanks!
Line 513 of woocommerce.php - had to remove 'widget_text' from the array of items that get filtered for the 'force_ssl' function.

Host static Wordpress blog on S3?

I have an old WordPress blog that I no longer use but want to keep the pages to support old incoming links. Right now I pay $20/mo for a t1.micro instance on EC2 just to run the stupid thing. I decided to use the Really Static plugin to extract the entire site in to static content with the goal to host it on S3's ability to host root domain content.
The good news is that the static export worked great. The bad news is that my URLs never used "clean URLs" and so the pages were stuff like http://example.com/blog/?p=123. The way the plugin works is that it exports a directory such as p=123 and then puts an index.html file in it.
My question is: does anyone have a bright idea on how (or if) I can host a URL like /blog/?p=123 and serve it from S3 using the static content I have? Even when I create a directory in S3 of ?p=123 I can only get /blog/%3Fp%3D123/index.html to serve while /blog/?p=123/index.html shows an access denied error.
Thanks!
http://www.slowping.com/index.html%3Fp=76.html discusses converting a wordpress blog to s3.
As you can see from the url, he's using the p= style of url. He seems to be using the directions from http://mossiso.com/2007/09/10/converting-wordpress-to-static-html.html though, so it may be that you just need to use a different converter.
Followup: Here's an article that discusses converting a custom themed wordpress install to octopress and it discusses some edge cases that may be relevant.
http://mrdanadams.com/2012/migrating-wordpress-custom-theme-octopress-jekyll/#.UUJxNltxuGo

Wordpress, why doesn't my blog load the posts if U use the /subfolder domain method?

I have a blog at http://hamids-it.elaosta.com amongst others. If I try to access it from
http://elaosta.com/hamids-it it loads the blog but says it couldn't find the page I wanted.
How do I fix this so I can use either?
I'm guessing you have a standard subdomain install, whereby http://subdomain.example.com is mapped to the directory /example.com/public_html/subdomain?
In any normal circumstance, say with a static HTML file, you can rightly access the same resource at both example.com/subdomain/resource.html and subdomain.example.com/resource.html.
However, in your case, WordPress is parsing the REQUEST_URI and using it to determine what to show.
So in the case of http://elaosta.com/hamids-it, WordPress is actually looking for a page 'hamids-it' - and if it doesn't find it, voila, your 404.
The fix?
You'll need to decide which way you want to access your blog, subdomain or sub-directory, then stick to it.
When you've made a choice, update your General settings in WordPress admin and set both address URL's to either http://hamids-it.elaosta.com or http://elaosta.com/hamids-it.

Resources