Jump to content

Archived

This topic is now archived and is closed to further replies.

cmgmyr

mod_rewrite to php script

Recommended Posts

I want to do a "MySpace" url rewrite.

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

And the beginning of my profile.php is: [code]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');
}[/code]

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

Share this post


Link to post
Share on other sites
When I go there I get:

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

Maybe this will help you: http://lotsofphp.com/tutorials/rewritten-urls-unlimited-parameters.html

Share this post


Link to post
Share on other sites
Right...That was just an example.

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

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

-Chris

Share this post


Link to post
Share on other sites
**SOLVED**

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

Thank you,
-Chris

Share this post


Link to post
Share on other sites
[b]EDITED BY WILDTEEN88: Please do not hijack other peoples threads. Please create your own thread[/b]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.