Is it possible to create virtual subdomains? - wordpress

I have a wordpress based site, that has data divided in it on the basis of country and state.
So the url goes like this
http://xyz.com/US/category_id
http://xyz.com/UK/category_id
there are no seperate folders for UK or US.
I was wondering if it possible to create multiple sub-domains like this
http://US.xyz.com
http://UK.xyz.com
without having different folders to route the sub-domains?

Of course.

Yes, but how you implement this depends on the type of service you use. Most light users purchase a shared hosting service. Your suppliers FAQs should give you advice. Some provide a control panel to map individual subdomains to separate subdirectories under your document root. Others simply map *.youdomain.com to your document root. In this latter case you need to use a .htaccess file and decode the HTTP_HOST to map each subdomain to a separate directory yourself.
If you do search here for [.htaccess] HTTP_HOST votes:2 then you will finds lots of examples of how to do this. :-)

Related

How do you use a website URL with no obvious extension

I am looking for any reference material for me to read up on, relating to what enables the following scenario where a website has a unique identifer appended to their domain name.
When you go to Facebook and view your profile, the URL in the address bar is something lile;
https://www.facebook.com/your_user_name.number
There is no obvious file extension, nor is the 'your_user_name.number' being passed as querystring value. I do know that I could create a folder on the web directory which is this name, and then you can direct to that folder and it will autoload the default or index files based on your web server settings. But i am not sure this is happening in this case, as then Facebook would have to create 2 billion + folders?
Browsing to your Photos on Facebook, it the url then looks like;
https://www.facebook.com/your_user_name.number/photos
I am keen to understand what this type of technical configuration is called. Happy to read up on it myself and learn about it, but I don't even know what it's called to search and read up on.
Any pointers?
What you are looking for is URL rewrite.
https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module
You can basically do whatever you want! No need for extensions or folders at all if you don’t want them anywhere.

Symfony: Multiple similar bundles with one master?

Let's say I have created a news portal bundle "NewsBundle" with articles, tags, events, lots of relations, quite huge and complex.
Now I want to copy this numerous times and create a Fashion News Portal, Car News Portal, Dog News portal and so on each available though an own domain. The portals differ only in templates, translations and assets. As I want to implement complex reporting, I want all the stuff in a single database and would flag all entities with the respective portal.
My question: How so I organize the code?
First I figured out, I could use routing to have the same application but different bundles for each domain.
Then I found out, that I could extend my master bundle. But it seems as this works only once.
As I did all the routing with annotations, it look like it does not work to inherit the routes from the master?
One of the hardest questions is where to put the portal switch. Somewhere I need to set a variable that tells whether its the fashion or dogs portal, so I can filter the content in all repositories accordingly.
I did that in the app.php which is for sure worst practise.
In the end I want to be able to roll out new portals easily without duplicate code.
Any ideas are much appreciated.
Greetings from Hamburg,
Boris
You need to keep your NewsBundle in your application, and to have a number of bundles revolving around it, one for each portal you intend to create.
There is no real need for bundle inheritance here. Your portal bundles depends on the NewsBundle but don't inherit from it.
Routing configuration, templating, and other behaviours related to a specific portal should go in the related bundle. There is a Resources folder in each bundle ; this is where you will need to put specific routing, translation, configuration and templates.
app/config/routing.yml is the central routing conf file where you will need to reference all other routing.yml file.
As for the switch, well, I can't answer that in detail but I think it should be set up in your server application apache or nginx (or other...).
Your problem can be solved via different environments. Each of your portal is a different environment. You can set up your web server to point different front-controllers depending on the domain requested.
Example:
For domain news.domain.com your front-controller would be web/app_news.php. And it will contain line:
$kernel = new AppKernel('news', false);
It will automatically load config from app/config/config_news.yml. In that config you can specify all specific parameters for your portal. You need then just implement your special loader for resources like translations that will load resources from the path specified in config_news.yml.

In Alfresco, creating folders under a site or under the document library of a site?

I am new to Alfresco. Using version 5.0.d.
I am developing CMIS based application code to index and access documents into Alfresco repository.
All these documents that our application would be storing is mainly by/for our application.
So probably a limited set of users of our clients might want to manage them through Share UI.
When I go into Alfresco Share interface, I see the concept of sites.
I decided to create a site for our application.
Then inside the site, I am able to create folders
Underneath the site, I also see a document library location, inside which as well I can create folders
I am having a hard time choosing or deciding on an approach.
In order to access the 'Sample' folder that is created directly under the 'testSite' site, CMIS (Java) code looks like this:
Folder folder = (Folder) cmisSession.getObjectByPath("/Sites/testSite/Sample");
In order to access the 'TestFolder' folder that is created under the document library of the site:'testSite', CMIS (Java) code looks like this:
Folder folder = (Folder) cmisSession.getObjectByPath("/Sites/testSite/documentLibrary/TestFolder");
Code does not look any different other than the path...
Can you tell me, why would anyone would prefer to organize their folders, one way or the other?
I also do not know if this is the best way, or if there is any other way, in CMIS API to access the folders underneath a site...
You do not necessarily need to use sites to store your contents.
Sites are designed as collaboration spaces. When you use a site you get "for free":
Simplified (but sometimes not flexible enough) role based access permissions. The idea is that a site manager decides, at the site level, the role of each user. Permissions can be applied to roles instead of groups or users. This helps to simplify the administration of permissions, but sometimes is not flexible enough. Using the API or accessing the folders of the sites in the "repository view" (see for example http://docs.alfresco.com/4.2/concepts/share-repodoclib.html), you can set more granular permissions, but doing it somehow breaks the "simplified" role based permissions.
Collaboration pages: document library, blog, calendar, data lists, etc...
A site dashboard that can have a different configuration for each site and site specific dashlets
Site visibility: public, moderate, private; and the function to invite users and manage users at site level
Probably other functionality that do not come to my mind right now
As I mentioned, the "document library" is one of the pages in a site. It is designed to collaborate on contents. If you are using sites, use the document library for contents on which users will collaborate. These contents are stored in the path:
/Sites/site-name/documentLibrary/
You can definitely create contents directly in /Sites/site-name/ but it won't be visible in the "document library" page of the site. This is what Alfresco does to store other type of contents associated with a site such as: data lists, calendar events, discussions, etc...
If your repository is accessed only with a custom application by CMIS, I am not sure that you will get any benefit using sites.
I wouldn't use it if you would end up with a single site.
I would suggest to use it, if you think that it can be useful to "invite" users to sites and assign permissions based on roles.

ASP.NET sub domain website's with same codes but different in Contents & Images

I currently have a website for eg:- www.domain.com & i need to create 3-4 sub domains for this website like
abc.domain.com,xyz.domain.com ...
I want to maintain the same codes for all the subdomains, & for each of the Sub domains i have the same look & feel except the css style, the logo's, the Page title's & few Page contents would be changing.
The titles & images(i will only store the image name) can come from the resource file,
Like for example i will have Resource file for each sub domains & my website should automatically pick the resource file based on the domain.
but not sure which is the best & easy way to achieve this.
Similar Question I have Seen based on UI Culture. I donot want to follow this approach. As i will be using English for all my subdomains & in future i will be having more sub domains.
If you have full-control over your web server and you are using IIS, you can achieve this easily by having multiple sites pointing to the same physical location in the file system. Then, each site can (and must) have a unique binding which will allow IIS to route incoming request to the appropriate site (sub-domain). Note that it is important that you have each site running on its own app pool rather than sharing the same app pool
Furthermore, you need to consider that the scalability of this approach is very limited, if in the future you need to have...say, hundreds of sites it can potentially add a lot of overhead to your web server. So, if you need a scalable solution you should go for a multi-tenant approach instead which you can easily load-balance.
One last note, images bundled up in resource files is a pretty bad idea...avoid it!!!
Site-specific content
Having different sites pointing to the same physical location doesn't mean that they have to share the same content all the time. You can still decide what content to serve dynamically based on the request context by simply inspecting the request object...this goes for dynamic ASP.NET pages, however for static pages you will need to create a virtual directory for each site and point them a location specific to that site only...this will allow you to customize the content for a specific site...see screenshot below how I have a "login" virtual directory which points to somewhere else...
Example
This is a very simplistic example. Suppose you have two sites set up...
en.domain.com
es.domain.com
The sites are pointing to the same physical location...C:\inetpub\domain\site
Then, there's a page index.aspx that has a panel in it that displays a welcome message...
<asp:Panel ID="pnlWelcome" runat="server"></asp:Panel>
for the "en" sub-domain you want to display "Welcome to Our Site" in english but for the "es" sub-domain you want to display "Bienvenidos a Nuestro Sitio" in spanish.
Then, if you set up a virtual directory for each site pointing to a separate location in the file system....say for the "en" domain the location is...C:\sitescontent\en\ and for the "es" domain the location is ...C:\sitescontent\es\, you can then place a user control, xml file, whatever you need inside these site-specific folders with the site-specific content. Then it is as easy as referencing the site-specific content with a virtual path...
string path = MapPath("~/content/{your_site_specific_content}");
or
Control ctrl = LoadControl("~/content/{your_site_specific_content}");
pnlWelcome.Controls.Clear();
pnlWelcome.Controls.Add(ctrl);
If you have a more complex architecture in your application, you would want to inspect the Request object to find out in which context the request is executing whether in the "en" site context or "es" site context....
HttpContext.Current.Request.Url.Host;
By NO means, I'm suggesting this the best way to handle localized resources in your system...it is just an example of how to handle site-specific content.

Symfony2 multi domain landing page

I need to attach many domains to a single instance of sf2 ... and based on the requested domain, geopip, language apply a particular view.
And I need it to be easy in the way of adding a new domain and a new "theme".
I've looked into liip, but I'm not that sure that's the best way to do it.
Any idea ?
Thanks
If your application has to manage multiple domains with distinct layout and templates for each one of them, then you've to use LiipThemeBundle
This bundle provides you the possibility to add themes. In your bundle directory it will look under Resources/themes/ or fall back to the normal Resources/views if no matching file was found.
Read the documentation full of examples here

Resources