Guesser
Guesser

Reputation: 1857

Apache - rewrite rule for user folders

I'm trying to get a url like www.domain.com/user/myuser to forward to www.domain.com/user/index.html?user=myuser the code below does not work.

RewriteRule ^user/?$ /user/index.html?user=$1 [QSA,L]

Upvotes: 0

Views: 23

Answers (1)

exussum
exussum

Reputation: 18550

does not work. is not helpful.

In this case your regex seems to be wrong. ^user/?$ means starts with user has an optional slash as the last letter

what you mean is

^user/(.*)$ which means match user/anything and redirect to /user/index.html?user=anything

so RewriteRule ^user/(.*)$ /user/index.html?user=$1 [QSA,L]

should work

Upvotes: 1

Related Questions