1
MikeShane
url rewright
  • 2008/2/8 21:08

  • MikeShane

  • Community Support Member

  • Posts: 144

  • Since: 2008/1/5 2


i found this code on another place and it works to link to profile page but how can I cahnge it to go to userpage so it will go dirctly to the website built by nenber.

include("../mainfile.php");
isset($_GET['link'])? $uname = $_GET['link'] : $uname = '';

if ($uname != ''){
$sql= sprintf("SELECT uid FROM %s WHERE (uname = '%s')",$xoopsDB->prefix("users"), $uname);
$result = $xoopsDB->queryF($sql);
list($uid) = $xoopsDB->fetchRow($result);
if ($uid > '0'){
$redirect_to = XOOPS_URL.'/userinfo.php?uid='.$uid;
} else {
$redirect_to = XOOPS_URL.'/index.php';
}

} else {
$redirect_to = XOOPS_URL.'/index.php';
}

header('location: '.$redirect_to);
Musicians for musicians entertaining the world, what starts as a dream can live in reality!

2
noo-b
Re: url rewright
  • 2008/2/9 5:43

  • noo-b

  • Just can't stay away

  • Posts: 456

  • Since: 2007/10/23


is page id is the same as the uid of the user who create the page ? if yes maybe change

Quote:

$redirect_to = XOOPS_URL.'/userinfo.php?uid='.$uid;


to
Quote:

$redirect_to = XOOPS_URL.'/modules/userpage/index.php?page_id='.$uid;
I Love Xoops

3
noo-b
Re: url rewright
  • 2008/2/9 5:45

  • noo-b

  • Just can't stay away

  • Posts: 456

  • Since: 2007/10/23


i just checked..not the same

Quote:

is page id is the same as the uid of the user who create the page ? if yes maybe change
I Love Xoops

4
wishcraft
Re: url rewright

Generally you can do SEO optimization/URL Rewrites with a .htaccess file, Have a look how I have done it for the announce in X-Torrent as an example, you will generally have to rewrite the code to look up information that is provided to it with some SQL injections.

and example of using a .htaccess file would be something like http://www.seo-solutions.co.in/freetools/Simple_Submission for the content module provided in the community modules packages.
Resized Image
http://www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

5
MikeShane
Re: url rewright
  • 2008/3/14 12:59

  • MikeShane

  • Community Support Member

  • Posts: 144

  • Since: 2008/1/5 2


I got this to work


Create a folder in your root and name it "users":

Create a .htaccess file under the "users" folder and paste this lines:



RewriteEngine on
RewriteCond %{REQUEST_URI} ^(^/users/)(.*)$
RewriteRule ^([^link].*)$ https://xoops.org/users/?link=%2 [R,QSA,L]



Were "www.xoops.org" should be changed to fit your site

Create now a index.php file under the "users" folder and paste this lines:



include("../mainfile.php");
isset($_GET['link'])? $uname = $_GET['link'] : $uname = '';

if ($uname != ''){
$sql= sprintf("SELECT uid FROM %s WHERE (uname = '%s')",$xoopsDB->prefix("users"), $uname);
$result = $xoopsDB->queryF($sql);
list($uid) = $xoopsDB->fetchRow($result);
if ($uid > '0'){
$redirect_to = XOOPS_URL.'/userinfo.php?uid='.$uid;
} else {
$redirect_to = XOOPS_URL.'/index.php';
}

} else {
$redirect_to = XOOPS_URL.'/index.php';
}

header('location: '.$redirect_to);
?>


I'd like to be able to just put code into htaccess instead of having to use a users folder any sugestions
Musicians for musicians entertaining the world, what starts as a dream can live in reality!

Login

Who's Online

311 user(s) are online (220 user(s) are browsing Support Forums)


Members: 0


Guests: 311


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits