HTML Rewrite

  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Posts: 679
  • Loc: Conroe, Texas

Post 3+ Months Ago

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
  • WritingBadCode
  • Graduate
  • Graduate
  • User avatar
  • Posts: 214
  • Loc: Sweden

Post 3+ Months Ago

I get: Page Not Found - 404 Error Page

=/
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8413
  • Loc: USA

Post 3+ Months Ago

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]
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9091
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

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
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8413
  • Loc: USA

Post 3+ Months Ago

Whuahaha... BigWeb was faster then my edits :o :shock:
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9091
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Also I think your $i Bogey, should be $1, unless there is another syntax I am unaware of :)
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8413
  • Loc: USA

Post 3+ Months Ago

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.
  • WritingBadCode
  • Graduate
  • Graduate
  • User avatar
  • Posts: 214
  • Loc: Sweden

Post 3+ Months Ago

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
  • Posts: 679
  • Loc: Conroe, Texas

Post 3+ Months Ago

it worked Thanks

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: Liamw411 and 114 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
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.