*This is NOT a module*
*This hack is only when Mikko's url plugin or anything else doens't work, it's the final redirection method*
*to make everything work with SEF, read the rest of the topic*
But the most relevant forum to post in...
The old version wasn't very good, but is in the locked forums anyway. (It was actually very bad...)
What does this do?
It makes it possible to have a URL redirection to a user profile without using mod rewrite or SEF (which is unsupported by ISS). It turns things like:
www.joomlapolis.com/timmy_the_slayer
into
www.joomlapolis.com/index.php?option=com_comprofiler&task=userProfile&user='timmy_the_slayer'&Itemid=1
Instructions:
1. Make a 404 errorpage (I assume you know how to do this so I won't explain it) which is a php file (so something like 404.php or 404errorpage.php or givemecookies.php) containing this:
[code:1]
<?php
echo $_SERVER;
?>
[/code:1]
2. Go to your joomlapage and type in anything that you know that doesn't exist, like this:
www.joomlapolis.com/hgjfghsjfldshg
3. You should see your errorpage now, and you should see something like this:
404;
www.joomlapolis.com:80/hgjfghsjfldshg
4. Copy that, without the non-existant thing that you typed behind it, which will make you get something like:
404;
www.joomlapolis.com:80/
(EVERYTHING has to be included, and so slashes too!)
5. Now replace everything in your errorpage with:
[code:1]<?php
$ysva_thingy="'";
$ysva_publicviewset="&Itemid=1";
if (!strstr($_SERVER,"www."«»))
{
$ysva_replacethis1=str_replace("404;
joomlapolis.com:80/
", "", $_SERVER);
header("Location:http://www.".$_SERVER."/index.php?option=com_comprofiler&task=userProfile&user=".$ysva_thingy.$ysva_replacethis1.$ysva_thingy.$ysva_publicviewset);
}
else
{
$ysva_replacethis2=str_replace("404;
www.joomlapolis.com:80/
", "", $_SERVER);
header("Location:http://".$_SERVER."/index.php?option=com_comprofiler&task=userProfile&user=".$ysva_thingy.$ysva_replacethis2.$ysva_thingy.$ysva_publicviewset);
}
?>[/code:1]
6. As you might have noticed, you need to replace all the
404;
www.joomlapolis.com:80/
with wat you got before.
7.
Done! There you have your own 404 redirection page to userprofiles of CB. Could you please give me some sweet karma lovin'?
Note:
It might be that you don't use things like
[code:1]index.php?option=com_comprofiler&task=userProfile&user='timmy_the_slayer'[/code:1]
but the searchengine unfriendly one's:
[code:1]/component/option,com_comprofiler/task,userProfile/user,'timmy_the_slayer'/Itemid,1/[/code:1]
Then you need to use this code in your 404 errorpage:
[code:1]<?php
$ysva_thingy="'";
$ysva_publicviewset="/Itemid,1/";
if (!strstr($_SERVER,"www."«»))
{
$ysva_replacethis1=str_replace("404;
joomlapolis.com:80/
", "", $_SERVER);
header("Location:http://www.".$_SERVER."/component/option,com_comprofiler/task,userProfile/user,".$ysva_thingy.$ysva_replacethis1.$ysva_thingy.$ysva_publicviewset);
}
else
{
$ysva_replacethis2=str_replace("404;
www.joomlapolis.com:80/
", "", $_SERVER);
header("Location:http://".$_SERVER."/component/option,com_comprofiler/task,userProfile/user,".$ysva_thingy.$ysva_replacethis2.$ysva_thingy.$ysva_publicviewset);
}
?>[/code:1]
EDIT: To make this automatically get the template and modules you've set for CB, change the 1 in
[code:1]$ysva_publicviewset="/Itemid,1/";[/code:1]
to the Itemid of the menu item for CB!
There you go, that wasn't all to bad for one of my first php creations was it?
Post edited by: ysva, at: 2007/01/04 23:27
Post edited by: ysva, at: 2007/01/04 23:29
Post edited by: ysva, at: 2007/08/30 16:39
Post edited by: ysva, at: 2007/08/30 16:41