Jump to content


Photo

www.mysite.com/johndoe rewrite


  • Please log in to reply
3 replies to this topic

#1 shawn2page

shawn2page
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 19 October 2006 - 01:30 AM

I need to get this code to do more:

RewriteRule ^([A-Za-z]+)$ profile.php?ID=$1

It now works so if they type www.mysite.com/johndoe it will take them to johndoe's page on our site. 

But the problem I have is if a member signs up with member name mark2000 the code will not work.  How can i set it up to work with numbers or symbols?

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 October 2006 - 05:01 PM

Add 0-9 after A-Za-z in the rewriterule

So its like this:
RewriteRule ^([A-Za-z0-9]+)$ profile.php?ID=$1


#3 shawn2page

shawn2page
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 21 October 2006 - 07:40 PM

that works great!  but can I get it to work with say www.mysite.com/john_moore or other charaters?

if so what would the code be

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 24 October 2006 - 05:23 PM

Add '-_' (without the quotes) after 0-9 in the square brackets

if you get a 500 error after doing that change, then you might need to use '\-_' instead.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users