How to assign external domain to the page of current website - php

Sorry if the question will seem little fuzzy and you will be tempted to down-vote it as soon as you read it. I am far from being an expert in system administration but I will try to explain the problem as clearly as I can.
I need to create a website where users can have profiles and attach an external domain to their profile page on this site. Let's say we have a site:
myresume.com
User will register and create a profile and his url will look like:
myresume.com/username
The feature I need to add should enable user to point his domain to his profile url.
Is it possible via php as my whole application will be written in laravel 5.2?
I will probably need to have my nameservers or just give user the IP address which he needs to point his domain to but then I will need to fetch the domain from my side somehow and point it to the url (myresume.com/username). How can it be done?
If someone could give an explanation how it is done or at least point where to search for an answer it would be amazing. Thanks.

You need to know how Apache NGINX works.
You need to know what $_SERVER['HOST'] is.
Logic to implement this.
This is how you will do it:
Host your app on a VPS / dedicated where your app is the 'default' with no other VirtualHost.
On your index.php file, define URL. If URL is set, let your Laravel's route choose which profile_id is matched with URL and then redirect the user to that URL or render the output.
Simple?

Related

How to authenticate a WordPress plugin by domain name?

I have a hybrid WordPress plugin that fetches all data using curl from the main server. Let's call it A.
B is the client that requests for data and also can send data to A.
Now every request is encrypted and authenticated using a API access keys.
But the problem here is if I copy the plugin from B to a new client site C, the moment I use the same access keys etc. the plugin starts working.
I want to be able to restrict the access of one API access key to one domain name. How can I attain that?
I'd say to include the allowed host's IP address (B) in your access key administration.
So: when B does a call, you can validate the key and the IP it's calling from.
On A, you can use something like $_SERVER['REMOTE_ADDR'] to test the IP calling the script.
Two downsides: when sites move servers, the plugin will stop working. And of course, people can still spoof their IP, so there is a way to get around this, but at least you make it a lot more complicated and probably not worth the hassle for most cases.
A suggestion by TJHX
Make it part of the license you give your customers. The honest ones will follow it, the dishonest ones will find a way to break your DRM. This is a problem technology can't really solve confidently, especially when with things like wordpress people can just see your code - By TJHX
I have also looked into a lot of options but the mere fact is that the user always has access to the code in the wordpress plugin and can easily make amendments to the CURL request Headers even if you encrypt it.
All we can do it add it in our Licenses.
In my plugin, there are iframes that will be loading the data on the frontend so I am going to accept the domain name when the user buys the plugin and will check the referrers to my iframe to sort this issue out.
Thanks a lot guys for your help.

sub-domain masks with htaccess

We have just created a Yammer Account and the link to our account is link this https://www.yammer.com/mydomain.org.uk/
I want to hide the word Yammer.com and mask it with the word social so the domain will look life this.
social.mydomain.org.uk
So If someone will open social.mydomain.org.uk it will show https://www.yammer.com/mydomain.org.uk/ but the address will be masked by social.mydomain.org.uk
I'm not very technical but I know how to change DNS and can upload htaccess file if someone can kindly tell me what exactly am I suppose to write in the file.
you can't solve this problem with htaccess.
one workaround would be to install a index.html with a html-frameset in it, which points the browser to yammer.com/… (example here: http://www.quackit.com/html/templates/frames/frames_example_2.html, you need to adapt the example a little bit)
caveat for this solution: you can't copy a deep url from the browser address bar and i don't know if yammer.com permits this solution.
htaccess would not be the best tool for this job. You can take it up steam to the dns level and throw a 302 or Web forwarding rule which most registrars will let you do from their interface with a CNAME.
HTHs
//P

one single app with different subdomains

I am looking for a solution for my project but I don't know if I chose a correct title for my question, so I should apologise everybody if it doesn't seem relevant somehow.
I have an application written by PHP which is like this: http://app.mysite.com.
What is happening in this app is that customers come and open an account for themselves. They will use this application to get in touch with their own clients in this way that they register their clients in this application and they can communicate with them. So it is somehow important that after their signup for the service, their company's name be shown in the address bar like this: http://TheirFrimName.mysite.com so their clients can identify that they are connecting to the correct path.
What I am looking for is to find a solution that I have only my application under app.mysite.com and when a client signs up, it creates a subdomain with their firm's name and then it redirects to my application path, but the address in address bar should remain with their subdomain address like TheirFirmName.mysite.com.
I don't want to stick to this idea, so if somebody has a better solution I appreciate if they want to share with me, otherwise, I humbly ask people who know how to perform what is in my mind.

What is the best way to give SAAS subscribers their own A Record for logging in to their dashboard?

The title should be pretty clear, but consider this scenario:
User bobbyflay registers an account on my SAAS app
I would like for the URL bobbyflay.myapp.com to direct him to a customer-specifi login page.
I'm developing on CodeIgniter 2.0.2 for what it's worth. Is there a better way than modifying the routes.php config file every time a new account is created?
You can create a wildcard record in your DNS that resolves all *. DNS lookups to a single IP address, then identify the specific subscriber using the Host header sent from the browser.
EDIT: see http://en.wikipedia.org/wiki/Wildcard_DNS_record for more detail.
This is exactly the article you're looking for.
Note it is written for an older version of CI but the methodology should be intact.
If you plan to implement this, at least consider disabling it via options; either "profile exists" or "profile not exists, hidden or disabled" messages should appear at accessing the subdomain - else your client's security/privacy may be harmed.

.htaccess twitter or facebook URL naming convention

For my Social Networking Site, I would like to build a facebook, or twitter similar URL rewriting naming convention.
Using Twitter as an example, they have pages labeled twitter.com/about and another page labeled twitter.com/{$username}
However, how do you differentiate between say a user who has registers on to our site as "about" then. From this we are going to have a server conflict between the user "about" and the page about.
What is the best way to handle this?
Usually, you'll see this implemented so that conflicts are not possible. For instance, you could camp all users inside a virtual /users directory, or a subdomain: mysite.com/users/msilvis, or users.mysite.com/msilvis.
I would not recommend that you make all users accessible via the root directory of your site, because this could potentially restrain you from adding pages. For instance, suppose you do not have yet an "about" page, but a user registers and calls itself "about"; you're screwed.
If you still choose to do so, before registration, try an HTTP request to your website to the page the user would have. If you don't get a 404, then something already has that name.
What our final decision came down to, was upon requesting a page on our server mysite.com/user, it first checked to see if that was a page, if it IS NOT a page, it assumes that it is a user, in which case it checks to see if that user is an object, if it is not then it gets passed to our 404 page.
So ontop of this, we are going to use the HTTP request like you mentioned earlier, and then if some how user "about" still signs up which we now have a page for, essentially sucks to be him because he is not going to see his page.
I would restrict the ability for someone to create a username that would conflict with existing urls.
If you're still in the early stages of development, you could look at the Kohana PHP framework. It's routing features solve the problem highlighted by zneak and dd, you would simply define in your routes that http://yoursite.com/about would point to a particular controller/action, i presume you're using the MVC design pattern considering you want a twitter like url structure.
Hope that helps!
EDIT: I forgot to mention that this doesn't stop people from signing up as about, it would just prevent the rest of the world from being linked to that persons page, in order to prevent them you'd need to employ some kind of validation against your core pages aka about, contact ect.

Categories