Multiregional Websites - multilingual

I would like to make a multiregional website but I am having some difficulties. I use cPanel and are laying out the domains as:
ca.example.com
usa.example.com
fr.example.com
I want to know how I would add the subdomains in and be able to use my one custom made php script to run these websites via .htaccess or whatever form.

You should use cPanel's parked domain feature. When you park a domain in cPanel, you can point it to the same root as your main domain. In the Parked Domains interface in cPanel, add your language subdomains (e.g. ca.example.com). All your language subdomains will then redirect to the same main domain (example.com).
Then, you can use PHP's $_SERVER['SERVER_NAME'] property to parse out the server name the user used to access the page, and in turn render the page in the correct language.

Related

Can I use different domains with react-js app

I have a web pages constructor.
Every user has opportunity to create web page on my resource.
There are several examples of that pages:
1 https://candylanding.netlify.app/601b1141bfa41700154f7e13
2 https://candylanding.netlify.app/6022ec4641423100151632d7
As you can see the url-addresses of these pages are ugly.
And I am sure that many users want to change it on some beautiful short name (such as DOMAIN.COM)
How can I achieve this? Please give me an idea..
using create-react-app, react-router-dom
Domain allocation is based off of domain ownership, so unless you own DOMAIN.COM users will not be able to use it.
Cloud platform as a service (PaaS) providers like Netlify and heroku use subdomains before the domain to create a clean URL, but you will need access to your server to do this (it won't be possible on netlify)
I think a good first step is allow users to name their route:
ie:
https://candylanding.netlify.app/my-user-site
instead of
https://candylanding.netlify.app/6022ec4641423100151632d7
Once you have that running you can then have a look at this question to dynamically create subdomains:
How to let PHP to create subdomain automatically for each user?

How to map a domain to server?

My AngularJS application running on NGINX server user profiles. I want users to point their domains to their profiles.
Example http://example1.com would serve http://example.com/#/foo profile.
I have created a custom nameserver i.e. ns1.example.com but I am not sure how to configure NGINX to point to the correct user account.
This is the sort of thing that you'll want to handle at the application level, and not in Nginx. That is, rather than updating and reloading your Nginx config files you should have something server side (like a lightweight Node.js application, for example) that would inspect the Host header. If the Host header value isn't your domain, then look up that domain in your database and serve up a 301 redirect..
Also note that there are some compatibility problems with using a redirect to an anchor fragment (like #/foo). Make sure you test well with the browsers that your users use most commonly.

Serve different app on particular subdomain in multi-tenant system

I have built an flask app hosted in App Engine, have used wildcard subdomain mapping along with namespace support provided App Engine so that app will be served from any subdomain. Its all working fine.
Now, I want to make one of the subdomain, say admin.domain.com to handle some admin related activities. All other subdomain points to normal app.
When un-registered user visits company.domain.com, it should be redirected to admin.domain.com where he will register, once done he will go back automatically to company.domain.com.
How to map a admin app to particular subdomain? Is there anyway to do it using Flask or App Engine? If not possible, how to handle this scenario?
This is the first time I am building such a app.
Thanks..
I'm not sure about the semantics when you use the word 'app'. In strict GAE sense, an apps are completely separate, each with its own billing and datastore etc.
If you strictly want to have the admin app as a separate app, you can't use the wildcard subdomain mapping. You'd have to manually map each subdomain using the App Engine admin settings for mapping domains. You can map the admin.domain.com to your admin app, and manually map your other subdomains to the normal app.
If you're just talking about separate admin functionality that runs in the same app, and you're not strictly set on using admin.domain.com, the best way is probably to use the new modules functionality and create your 'admin' as a separate module and use dispatch.yaml to route to it:
https://developers.google.com/appengine/docs/python/modules/routing
Otherwise, Flask/GAE doesn't really provide any built in mechanism for this. You'd have to do something messy like check the URL in every request handler and act appropriately if it's admin.

Redirecting domain (not google apps) to appengine

I'm building a application that supports different domains. A small CMS that supports different domains.
But what I can't figure out is how to redirect other domains that's outside google apps. I have a domain at google apps, that work's perfectly.
When I create a cname that points at either my appid.appspot.com or www.appsdomain.com it just goes to google.com.
What do I need to do so the other domains point to my appengine application.
..fredrik
You can't just use a cname because google needs to know how to direct the requests through their infrastructure to your app.
You should follow the instructions here: http://code.google.com/appengine/docs/domain.html to set up your name with their infrastructure so that requests to the cname get routed correctly.
Update: You do not have to move your domain to google, only inform them of the names you are going to set up cnames to point to them.
You can do that without a cname.
You need to set up a redirection mechanism of your second domain name. You can do that either by telling your registrar to redirect that url to your Google Apps url (that's how I do it with my registrar, name.com), or you could set up a small [php] script on a server you manage that would receive the queries on the second domain and issue a 301 redirect to your Google Apps domain.
EDIT: It all depends on what you want to do. If you want your app to live at both urls, then this solution will not work. I wrote this in the idea that you want the second url to redirect to your main url, if that's not what you want to do, then issuing redirects won't do the trick.

How to use Google App Engine with my own naked domain (not subdomain)?

After hours of reading about and experimenting with DNS records I can access my Google App Engine app via these URLs:
myappid.appspot.com
www.myappid.myowndomain.example
What does not work:
myowndomain.example
www.myowndomain.example
I want to be able to serve my app directly off my domain and not a subdomain. I've seen apps that do this. Is there any way to do this without a URL redirect?
[Update April 2016] This answer is now outdated, custom naked domain mapping is supported, see Lawrence Mok's answer.
I have figured it out!
First off: it is impossible to link something like mydomain.example with your appspot app. This is considered a naked domain, which is not supported by Google App Engine (anymore). Strictly speaking, the answer to my question has to be "impossible". Read on...
All you can do is add subdomains pointing to your app, e.g myappid.mydomain.example. The key to get your top level domain linked to your app is to realize that www is a subdomain like any other!
myappid.mydomain.example is treated exactly the same as www.mydomain.example!
Here are the steps:
Go to appengine.google.com, open your app
Administration > Versions > Add Domain... (your domain has to be linked to your Google Apps account, follow the steps to do that including the domain verification.)
Go to www.google.com/a/yourdomain.example
Dashboard > your app should be listed here. Click on it.
myappid settings page > Web address > Add new URL
Simply enter www and click Add
Using your domain hosting provider's web interface, add a CNAME for www for your domain and point to ghs.googlehosted.com
Now you have www.mydomain.example linked to your app.
I wished this would have been more obvious in the documentation.
[update 2015-09-28] Now Google lets you add custom domains (including naked domains) and setup SSL without the need of Google Apps. For details refer to here: https://cloud.google.com/appengine/docs/using-custom-domains-and-ssl?hl=en
I just discovered today (as of 2014-04-11) a new custom domain settings page is available from Google Developers Console:
1. Go to https://console.developers.google.com/project
2. Click on your project
3. On the left click "App Engine"
4. Click "Settings"
There you go! You can configure custom domain without the need of Google App account!
[Update April 2016] This answer is now outdated, custom naked domain mapping is supported, see Lawrence Mok's answer.
See http://www.google.com/support/a/bin/answer.py?hl=en&answer=91077 for the details. Once you have signed up for Google Apps for Your Domain:
# Sign in to the Google App Engine admin console.
# Go to Administration > Versions
# Click the 'Add Domain...' button under Domain Setup.
# Enter your domain name in the 'Domain Name:' field
# Click 'Add Domain'. You will be directed to the Google Apps administrator console to complete the process.
# Log in to the Google Apps control panel with your administrator account.
# Accept the terms and specify the access URL you'd like to provide for your application.
# Click 'Accept
You can't use a naked domain, though, such as whatever.example (but www.whatever.example does work), because:
Due to recent changes, Google App Engine no longer supports mapping
your app to a naked domain. If your domain registrar supports URL
redirects, you can redirect from http://yourdomain.example to your app,
which can be served from domains like http://www.yourdomain.example or
http://appid.yourdomain.example.
as specified at http://www.google.com/support/a/bin/answer.py?answer=91080
If like me you have seen this message while trying to add 'www' as a subdomain inorder to get your own domain working:
'Already used, please remove previous
mapping first . '
The above process mentioned in other answers has changed slightly if you are using Google Apps for your domain.
You must now do this as well:
Google Apps -> Service Settings -> Sites. Click 'Web address mapping' and remove the 'www' mapping which has been added by default to Sites.
Then you can add the 'www' subdomain for your App engine app
see this link:
http://groups.google.com/group/google-appengine/web/deleting-existing-www-mapping-from-google-apps
Another solution which is given by Google is URL forwarding: http://www.google.com/support/a/bin/answer.py?hl=en-in&answer=61057
Google does offer naked domain redirection.
Login to your google apps account and select "manage this domain"
Navigate to Domain settings
Within Domain Setings, navigate to Domain names
There's a link that says "change the A record". Clicking that will give you the destination IPs for the A records you need to create.
Google does not provide an IP for us to set A record. If it would we could use naked domains.
There is another option, by setting A record to foreign web server's IP and that server could make an HTTP redirect from e.g domain.example to www.domain.example (check out GiDNS)
For App Engine in 2019, googles has made it easier to set up a custom domain.
Google App Engine -> Settings -> Custom Domains
Verify your domain
Select Your Domain Name Registra
Reminder: Use TXT Record with the value Google provides without a existing CNAME record, otherwise TXT Record will be override
Follow the steps on the page, which includes the configuration of your subdomain, CNAME Record, A Record, AAAA Record, and you'll be good to go.
Just managed to sort this finally after hours. The www subdomain was pointing to Sites, but the front end wasn't showing me that.
After taking the plunge and setting the CNAME to gwh.google.com, and enabling / disabling Sites a couple of times (see the comment from Rodrigo Moraes on http://groups.google.com/group/google-appengine/web/deleting-existing-www-mapping-from-google-apps) I was able to set the Sites address to use the www subdomain.
I was then able to change it away from using the www subdomain, at which point the appengine app allowed me to specify the www subdomain.
That is one dirty fix - basically turning on and off Sites until it works!
When you go to "Application Settings -> Add Domain" It will ask to select login account, probably you are already on gmail account so it will show gmail account as well, but you should use Google Apps account where you have mapped your custom domain.
You can redirect forward or mask your domain name in godaddy but I don't know about other hosting sites.Have a look on this link
Here is a tutorial from Google about mapping your App on custom domain: https://cloud.google.com/appengine/docs/domain?hl=FR
It should be the latest update. But please note these 2 things:
1- You may not find you App in the new developer console, then the only workaround for that is download your source code, create a new app from the new developer console and deploy it.
2- You find your App on the developer console, but under the Compute menu you may not find the App Engine Settings as mentioned in the tutorial, then you have to proceed the same as i explained in the first point (create another application)
I hope this helps !
You can create a custom domain (including naked domain) for your App Engine and you can also set up self managed SSL certificates there.
To use a custom domain, map the domain to your app, then update your DNS records. You can map a naked domain, such as example.com or a subdomain, such as subdomain.example.com. You can also use wildcards to map subdomains.
The steps to map custom domain to your application are following -
In Console,go to the Application settings tab of the App Engine Settings page
-->If you need to enable G Suite authentication then click Edit to modify the Google Accounts API Referrer-->In the Google Authentication drop-down menu, select G Suite domain, then add your domain such as example.com in the empty field.
Go to the Custom Domains tab of the App Engine Settings page--> Click on add custom Domain-->If your Domain is already verified then select it from the drop down menu-->click Continue.
If you haven't verified your domain yet, follow the steps below:
a) Select Verify a new domain from the drop-down menu.
b) Enter your naked domain name (such as "example.com") and click Verify.
c) Enter information in the Webmaster Central window that appears.
d) After you complete the steps in Webmaster Central, return to the Add a new
custom domain page in the Google Cloud Console.
In the Point your domain to (project-ID) section, specify the domain and subdomains that you want to map.We recommend mapping the naked domain and the www subdomain-->click Save mapping.
Sign in to your domain registrar web site and update your DNS records.
Please refer to the following link for detailed description of required steps -
https://cloud.google.com/appengine/docs/standard/python/mapping-custom-domains
You must try like this, Application Settings > Add Domain...

Resources