Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want it so when I write the following:

http://boundsblazer.com/user/joe

it internally processes the page:

http://boundsblazer.com/user/profile?usr=joe

But keeps the old URL. However, when I write:

http://boundsblazer.com/user/joe

the URL becomes:

http://boundsblazer.com/user/profile?usr=joe

I have searched countless threads, and nobody is having the trouble I am. The problem is that when I write my URL, the URL changes and makes it look ugly. This is my .htaccess:

RewriteEngine on
RewriteRule ^user/([a-zA-Z0-9]+)$ http://boundsblazer.com/user/profile.php?usr=$1 [L,QSA]

Does anyone know what could be causing the problem?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
585 views
Welcome To Ask or Share your Answers For Others

1 Answer

Use this:

RewriteEngine on
RewriteRule ^user/([a-zA-Z0-9]+)$ /user/profile.php?usr=$1 [L,QSA]

The issue is that you are using an absolute URL, instead of a relative URL, and mod_rewrite is performing a redirect instead of a rewrite.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...