How to rewrite this rule with .htaccess ?

I want rewrite this rule:

http://mydomain.com/a_String- > http://mydomain.com/login.php?username=a_String

How to do this?

Thanks!
laptop1vnAsked:
Who is Participating?
 
caterham_wwwCommented:
Well, if your don't have a pattern like /f_bar as described above but /foo, the regEx can't match.
RewriteEngine on
RewriteBase /
RewriteRule ^([a-z]+)$ /login.html?user=$1 [L]
RewriteRule ^fi/(.*)$ /fi.html?s=$1 [L]

Open in new window

0
 
caterham_wwwCommented:
> a_String

Is that your pattern, i.e. character, underscore, characters?
RewriteEngine on
RewriteRule ^([a-z]_[a-z]+)$ /login.php?username=$1 [L]

Open in new window

0
 
laptop1vnAuthor Commented:
Seem not success?

I tried:

http://mydomain.com/something

RESULT:
------
Not Found

The requested URL /something was not found on this server.

------

I already have other rewrite, it run OK

My htaccess:

RewriteEngine on
RewriteBase /
RewriteRule ^([a-z]_[a-z]+)$ /login.html?user=$1 [L]
RewriteRule ^fi/(.*)$ /fi.html?s=$1 [L]
...


0
 
laptop1vnAuthor Commented:
It's OK!
Thank caterham_www much :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.