url redirection to username via 404 Errorpage

13 years 1 month ago #22170 by ysva
For the people with a windows host (Or any other way in which they cannot use Mod_Rewrite in their .htaccess) , it's not possible to do url redirection to someone's username like this:

www.scalaleerlingensite.nl/admin

to
www.scalaleerlingensite.nl/index.php ?

option=com_comprofiler&task=userProfile&user='admin'


I found an alternative.

When you try to go to

www.scalaleerlingensite.nl

you get redirected to my 404 errorpage.
I put in my 404.php some code that redirects the user to the profile.

This is the code:

<?php

$thingy = "'";
$publicviewset = "&Itemid=1";


if (!strstr($_SERVER,"www."))
{
header("Location: http://www.".

$_SERVER."/index.php?option=com_comprofiler&task=userProfile&u

ser=".$thingy.substr($_SERVER,46).$thingy.$publicviewset);
}
else
{
header("Location:

http://".$_SERVER."/index.php?option=com_comprofiler&task=user

Profile&user=".$thingy.substr($_SERVER,50).$thingy.$publicvi

ewset);
}
?>


Enter this into your 404.php file.
Then get the address to your php file, which is for me:

scalaleerlingensite.nl/404.php

You need to count the number of characters that this address contains. For me this is 46 characters. I entered this number in the code (look for the number 46 in the code above so you can see where I put it).

You can also see that there is an "else" in the code.
That's my redirection for if someone is on

www.scalaleerlingensite.nl

which is with my www. subdomain.
For this you need to go to your 404 file, with the subdomain, which for me is:

www.scalaleerlingensite.nl/404.php

and again count the number of characters. For me this is 50, and you can see the number in my code so you know where to enter it.

There! Now you have your own url redirection system!:laugh:
Have fun with it;)
ysva

Post edited by: ysva, at: 2006/10/08 11:12
13 years 1 month ago #22178 by ysva
I deleted this post myself.
Please go to page 2.

Post edited by: ysva, at: 2006/10/08 11:11
13 years 1 month ago #22183 by ysva
I deleted this post myself.
Please go to page 2.

Post edited by: ysva, at: 2006/10/08 11:11
13 years 1 month ago #22206 by ysva
I deleted this post myself.
Please go to page 2.

Post edited by: ysva, at: 2006/10/08 11:11
13 years 1 month ago #22207 by ysva
I deleted this post myself.
Please go to page 2.

Post edited by: ysva, at: 2006/10/08 11:12
13 years 1 month ago #22208 by ysva
I deleted this post myself.
Please go to page 2.

Post edited by: ysva, at: 2006/10/08 11:12
Moderators: beatnantkrileon
Time to create page: 0.404 seconds
Facebook Twitter Google LinkedIn