Mobile app version of vmapp.org
Login or Join
Yeniel560

: Make a domain point to another domain I have never been able to figure out how to do this. I am working on a PHP script. With my script, each user will have access to their own site. For

@Yeniel560

Posted in: #Domains #Htaccess

I have never been able to figure out how to do this.

I am working on a PHP script. With my script, each user will have access to their own site.

For example, the URL for this would be myscript.com/frontend/username where this uses an htaccess file to generate their site based on the username in the URL. (hope this makes sense).

Now I want to make it so that they can have their domain point to this.

For example, lets say their domain name is theirsite.com.

I want to make it so that, say if someone visits theirsite.com/about it really points to myscript.com/frontend/username/about

More examples:


theirsite.com/about should point to myscript.com/frontend/username/about
theirsite.com/blog/post-12 should point to myscript.com/frontend/username/blog/post-12
theirsite.com should point to myscript.com/frontend/username


How do I do this?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Yeniel560

1 Comments

Sorted by latest first Latest Oldest Best

 

@Jamie184

You could set up theirsite.com as a parked domain on top of myscript.com. This initially allows theirsite.com to be an alias for myscript.com. You can then use mod_rewrite (in .htaccess) to internally rewrite to the real URL (similar to what you have done already). You can only rewrite to a URL on theirsite.com (not myscript.com), which shouldn't be a problem since one is an alias for the other - unless there is something in your script that relies on the domain being myscript.com?

So, something like the following in .htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} =theirsite.com [NC]
RewriteRule ^(.*)$ /frontend/username/ [L]


Although you would probably skip this step and rewrite to the actual URL - which you are already doing. So this effectively replaces your current rewrite rule.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme