I'm trying to learn how to rewrite URLs on my website, and I've followed several tutorials and read through the questions on here, but I keep getting an internal server error. I want to redirect user.php?u=$log_username to juster example.com/$log_username. I commented out each line, and only the the last line generates the error. This is what I have now:
RewriteEngine On
RewriteBase /
Rewrite Rule ^[A-Za-z0-9]+/?$ user.php?u=$1 [R=301,L]
You have a syntax problem in your rule. Instead of Rewrite Rule
you need RewriteRule
:
RewriteEngine On
RewriteBase /
RewriteRule ^([A-Za-z0-9]+)/?$ user.php?u=$1 [QSA,L]
You also needed to capture the URI in a group.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.