• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

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!
0
laptop1vn
Asked:
laptop1vn
  • 2
  • 2
1 Solution
 
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
 
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
 
laptop1vnAuthor Commented:
It's OK!
Thank caterham_www much :)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now