Connecting Tech Pros Worldwide Help | Site Map

How i can have a .htaccess like twitter.com?

  #1  
Old June 29th, 2009, 11:14 AM
Newbie
 
Join Date: Jun 2009
Posts: 11
Hi

I wanna have a htaccess file that when i go to "www.domain.com/sometext" the page redirect to "www.domain.com/user.php?user=sometext". It's important that is better that URL not end with slash. I have a problem with my htaccess file:

Expand|Select|Wrap|Line Numbers
  1. RewriteEngine on
  2. RewriteRule ^(.+)$ user.php?user=$1 [L,R]
But when i go to to "http://localhost/jack" the page will redirect to "http://localhost/user.php?user=user.php".

I have read this topic, but is it possible that "user" phrase doesnt exists after "^" character?
  #2  
Old July 15th, 2009, 03:04 PM
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,858
Provided Answers: 9

re: How i can have a .htaccess like twitter.com?


Quote:
Originally Posted by Lagon666 View Post
Hi

I wanna have a htaccess file that when i go to "www.domain.com/sometext" the page redirect to "www.domain.com/user.php?user=sometext". It's important that is better that URL not end with slash. I have a problem with my htaccess file:

Expand|Select|Wrap|Line Numbers
  1. RewriteEngine on
  2. RewriteRule ^(.+)$ user.php?user=$1 [L,R]
But when i go to to "http://localhost/jack" the page will redirect to "http://localhost/user.php?user=user.php".

I have read this topic, but is it possible that "user" phrase doesnt exists after "^" character?
Remove the 'R' from your flags ([L, R] -> [L]).
Reply

Tags
apache, htaccess, twitter