coyote999
Posts: 22
|
Posted: 07/24/2011, 5:30 AM |
|
Hi All!
Does anyone have experience in scrambling the URLs of Codecharge-Project?
My goal is to hide the parameters (like index.php?test_id=123) for the frontend users.
I read something about modrewrite, but i do not want to have searchengine-friendly URLs.
Thanks for your help
Martin
|
|
|
datadoit
|
Posted: 07/24/2011, 6:58 AM |
|
Well what's it going to be Martin ... Scramble or hide? :)
Apache's mod_rewrite module is enormously flexible and powerful, but
prepare yourself for complexity with a steep learning curve.
mod_rewrite would work well for your scrambling needs. It's not just
for SEO purposes. mod_rewrite was around long long before SEO was an
acronym for anything meaningful.
For hiding the URL parameters, this can be accomplished with relative
ease in CodeCharge by simply using a session cookie to store all of the
pertinent parameters. You'll just need a little extra effort to make
certain management of those parameters is handled properly (ie: clear
parameters where appropriate).
Below is a little routine to put in your page's Before Initialize that
will remove the page's name from the URL.
//For cleanliness, we don't want to show the page name in the URL.
However, if there is a form submission error, then the page name MUST
show in the URL.
global $FileName, $Redirect;
$URI = isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] :
isset($_SERVER["SCRIPT_NAME"]);
$QueryString = CCGetQueryString("All", "");
$pos = strpos($URI, $FileName);
if ($pos AND !CCGetParam("ccsForm", "")) {
if ($QueryString) {
$Redirect = ServerURL . "?" . $QueryString;
}
else {
//Strip off the last forward slash from the URL.
$Redirect = substr(ServerURL, 0, CCStrLen(ServerURL)-1);
}
}
|
|
|
|