• 0

User addresses like on twitter


Question

I'm wondering if anybody could tell me how I could go about getting nice page addresses like twitter has (ie. twitter.com/username) instead of something like twitter.com/profile.php?user=129040404.

I'm looking to do the same thing in PHP for a site I'm working on at the moment.

Thanks.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Thanks a lot for that. Is there any way that I can make an exception for a few different addresses? For example, I have an address like twitter.com/questions, but now with the rewrite rule it essentially thinks I mean twitter.com/profile.php?user=questions when I don't want that at all.

Do you know how I would add an exception to htaccess? Thanks a lot!

Link to comment
Share on other sites

  • 0

Thanks a lot for that. Is there any way that I can make an exception for a few different addresses? For example, I have an address like twitter.com/questions, but now with the rewrite rule it essentially thinks I mean twitter.com/profile.php?user=questions when I don't want that at all.

Do you know how I would add an exception to htaccess? Thanks a lot!

Try something along the lines of:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/questions
RewriteRule ^/([^/\.]+)/?$ ./profile.php?user=$1 [L]

I've not tested this, but it should work.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.