Jump to content


Photo

mod_rewrite to php script


  • Please log in to reply
4 replies to this topic

#1 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 01 August 2006 - 03:22 PM

I want to do a "MySpace" url rewrite.

My .htaccess is:
RewriteEngine  on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ /profile.php?moduser=$1 [L]

And the beginning of my profile.php is:
global $moduser;

if(isset($moduser)){
		$query = "SELECT userid FROM users WHERE mod='$moduser'";
		$result = mysql_query($query) or die('Query failed: ' . mysql_error());
		$userid = mysql_result($result, 0, 'userid');
	}

when I go to mysite.com/username it doesn't do anything. It just hangs up, no error message or anything.

Let me know if you need any more information

Thanks,
-Chris

#2 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 01 August 2006 - 03:29 PM

When I go there I get:

404 Error -- File Not Found
The page you are looking for (http://mysite.com/username) is not here.


Maybe this will help you: http://lotsofphp.com...parameters.html

#3 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 01 August 2006 - 03:32 PM

Right...That was just an example.

The actual link is: http://www.syracuseb....net/new/cmgmyr

Should go to: http://syracusebands....php?userid=169

-Chris

#4 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 01 August 2006 - 04:58 PM

**SOLVED**

What I did was change that bottom line to: RewriteRule ^([^/\.]+)/?$ profile.php?moduser=$1 [L]

Thank you,
-Chris

#5 vivek

vivek
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 21 September 2006 - 06:40 AM

EDITED BY WILDTEEN88: Please do not hijack other peoples threads. Please create your own thread




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users