Forum Moderators: phranque

Message Too Old, No Replies

HELP Pointing domains to php file to interpret what is displayed

htaccess redirects with php database

         

BrettP

10:55 pm on Aug 7, 2010 (gmt 0)

10+ Year Member



Ok, First off! THe site owner must be a GOD because he has my name! Brett's RULE!

Here is my problem.
Im buying a VPS to host my network. Im trying to set it up templated. I will have multiple domains pointing to my server. This is my question.
How do I point those domains to a file that will manage what That specific domain should look like? It is all for the same system so im trying to creat a network managed simply.

I beleive i would use .htaccess to do this but what im trying to do is get for example:
xyz.com to point to template.php?site=xyz.com
abc.com to point to template.php?site=abc.com
and so on...
then my template.php file will read a mysql database to build the site according to the database specs.

my VPS will be linux with cpanel if that is needed im not sure.

P.S. I also want to re write file names to be directory names for example.
xyz.com/display.php?item=4 I would like to read xyz.com/itemname/

Im extremely new to VPS and have used godaddy shared hosting so Im very "in the dark" with what I would need to do. any help would be appreciated!

<snip> I'm in need of really big help with this.. Thanks.

And again Brett's Rule! LOL

[edited by: jdMorgan at 4:41 pm (utc) on Aug 9, 2010]
[edit reason] Snipped per TOS #3 [/edit]

g1smd

6:24 am on Aug 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This is a fairly common question here. Please check prior threads for some very detailed discussion and get-you-started code examples.

Be aware that it is links that define URLs, so the links on the page define the URL the browser requests when the link is clicked.

A rewrite connects that request to an internal server location other than the default value that was suggested in the path part of the URL request.

jdMorgan

4:42 pm on Aug 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Rewriting "file" URLs to end with a slash is a waste of time and bytes. I'd recommend *not* doing that.

Jim

g1smd

5:05 pm on Aug 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



To clarify, the rewrite is a good idea, but omit the trailing slash.

BrettP

8:24 am on Aug 10, 2010 (gmt 0)

10+ Year Member



I guess let me clarify,
I will have an admin area a client will log into point their domain to my server which will rewrite it to a file that they will edit in the admin. So im trying to figure out how to rewrite the domain i guess to a file.

jdMorgan

1:53 pm on Aug 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



They will have to use their own registrar's DNS control panel to point their domain to your server's unique (i.e. non-shared) IP address or use a CNAME to point their domain to your domain (recommended in case your server's IP address changes).

To clarify, for this to work, you will need to use IP-based virtual hosting, a VPS, or dedicated hosting, and not a name-based virtual server.

Then in a server config file or in .htaccess, just use one of the "domain to subdirectory" or "domain to script" rewrites you'll find posted here -- do a "site" search on Google or use the WebmasterWorld search facility. There are many variations you could use, depending on how you want to accomplish this.

Jim

BrettP

11:32 pm on Aug 10, 2010 (gmt 0)

10+ Year Member



Jim! Thankyou just the answer I was looking for! Im trying to write it dynamically with mysql and php so that is my actual question Im sure i will find it. Thanks again