0

Apache / ColdFusion: Replicated websites?

 3 years ago
source link: https://www.codesd.com/item/apache-coldfusion-replicated-websites.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Apache / ColdFusion: Replicated websites?

advertisements

So I've done this before a number of different ways, but I wanted to get the opinion of the community.

What needs to be accomplished is essentially dynamic URLs that pull in content depending on what exists in the URL. Example:

http://www.domain.com/userA/

This URL would pull in userA's content and populate the website. The idea is so multiple people can have their own custom spot on the website. It's the same website for everyone, but the user specific information changes per the URL request.

Taking this a step further, to be able to call example.com/userA/mediaID and display a video from userA.

Like I said, I've done this before, but I want to do it with best practices in mind... perhaps a combination of htaccess and CGI?

Thoughts?


Use the Apache rewrite module to send the request through a front controller. So your httpd.conf would have an entry that looks something like this:

# QSA preserves original query string
# PT Sends the new URI to ColdFusion
# NS (No [internal] Subrequests) is necessary because expandPath() will not work otherwise
RewriteRule ^/(.*) /frontcontroller.cfm [E=ORIGINAL_URI:%{REQUEST_URI},QSA,PT,NS]

This makes CGI.ORIGINAL_URI available to ColdFusion code this allows for dynamically generating the response and securing it relative to the user session.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK