Jump to content

Archived

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

shawn2page

www.mysite.com/johndoe rewrite

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Add 0-9 after A-Za-z in the rewriterule

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

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.