HTML Rewrite

  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Joined: Jun 21, 2006
  • Posts: 476
  • Loc: Conroe, Texas
  • Status: Offline

Post May 17th, 2011, 10:17 am

I have no idea on how to do this.. I want it to look like this.

http://www.mysite.com/person

from this

http://www.mysite.com/userinfo.php?user=person
Thanks, Josh --DemonMaestro
www.LilNetwork.com
Fun Website www.ShoutsCloud.com
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post May 17th, 2011, 10:17 am

  • WritingBadCode
  • Graduate
  • Graduate
  • User avatar
  • Joined: Apr 28, 2011
  • Posts: 214
  • Loc: Sweden
  • Status: Offline

Post May 17th, 2011, 10:59 am

I get: Page Not Found - 404 Error Page

=/
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post May 17th, 2011, 11:04 am

WritingBadCode wrote:
I get: Page Not Found - 404 Error Page

=/

Look at the URL he gives... it's mysite.com

He didn't make those URL as links... phpBB3 system did... Just clarifying this :D

What he is showing is how he wants the links to be rewritten rather then showing his site.


Code: [ Select ]
RewriteRule ^user/(.*) /userinfo.php?user=$1 [QSA,L,NC]
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8921
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post May 17th, 2011, 11:11 am

In your .htaccess file add:

Code: [ Select ]
RewriteEngine On

RewriteRule ^([a-zA-Z0-9]+)$ /userinfo.php?user=$1
  1. RewriteEngine On
  2. RewriteRule ^([a-zA-Z0-9]+)$ /userinfo.php?user=$1


See how that works. If you plan to have other pages you may want to put your user search under a user directory or something, or somehow separate searches for users. For instance you could do:

Code: [ Select ]
RewriteEngine On

RewriteRule ^user/([a-zA-Z0-9]+)$ /userinfo.php?user=$1
  1. RewriteEngine On
  2. RewriteRule ^user/([a-zA-Z0-9]+)$ /userinfo.php?user=$1


Which would make it so that unless the link starts with user/ it would only load regular pages and do no rewriting. So for instance:

http://www.mysite.com/person

Would only return something if you had a file called person, but:

http://www.mysite.com/user/person

Would actually execute:

http://www.mysite.com/userinfo.php?user=person
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post May 17th, 2011, 11:13 am

Whuahaha... BigWeb was faster then my edits :o :shock:
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8921
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post May 17th, 2011, 11:16 am

Also I think your $i Bogey, should be $1, unless there is another syntax I am unaware of :)
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post May 17th, 2011, 11:23 am

Bigwebmaster wrote:
Also I think your $i Bogey, should be $1, unless there is another syntax I am unaware of :)

No, it's supposed to be $1... I was thinking $1 but my hand decided to show me who's boss :(

Thanks for that heads up.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • WritingBadCode
  • Graduate
  • Graduate
  • User avatar
  • Joined: Apr 28, 2011
  • Posts: 214
  • Loc: Sweden
  • Status: Offline

Post May 17th, 2011, 11:51 am

Bogey wrote:
WritingBadCode wrote:
I get: Page Not Found - 404 Error Page

=/

Look at the URL he gives... it's _______

He didn't make those URL as links... phpBB3 system did... Just clarifying this :D

What he is showing is how he wants the links to be rewritten rather then showing his site.


Code: [ Select ]
RewriteRule ^user/(.*) /userinfo.php?user=$1 [QSA,L,NC]


oh man, I thought this was a easy to solve HTML issue where he wanted his HTML to be rewritten so it looked the same as on his other page or something like that. :lol:
  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Joined: Jun 21, 2006
  • Posts: 476
  • Loc: Conroe, Texas
  • Status: Offline

Post May 17th, 2011, 4:23 pm

it worked Thanks
Thanks, Josh --DemonMaestro
www.LilNetwork.com
Fun Website www.ShoutsCloud.com

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 103 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.