0

So I have a rewrite rule for user names as follows

RewriteEngine On
RewriteBase /test/

Options FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{QUERY_STRING} ^(.*)$

RewriteRule ^/?([A-Z0-9a-z\~\^\(\)_\-\+\{\}\[\]\|:\<\>\.]+)$ index.php?user=$1 [L]

This works fine, and I can echo $_GET['user'] no problem. The issue happens when I add another variable to the rewrite rule as follows -

RewriteRule ^/?([A-Z0-9a-z\~\^\(\)_\-\+\{\}\[\]\|:\<\>\.]+)$/?extra$ index.php?user=$1&system_page=extra [L]

I was hoping to be able to go to http//localhost/test/username/extra and echo $_GET['system_page'] with the result of "extra", but I receive a 404 error instead.

Any help on this much appreciated.

1 Answer 1

1

Ok, figured it out. For any of you who run into the same problem, the solution is to remove the "$" after the username definition.

RewriteRule ^/?([A-Z0-9a-z\~\^\(\)_\-\+\{\}\[\]\|:\<\>\.]+)$/?extra$

should instead be -

RewriteRule ^/?([A-Z0-9a-z\~\^\(\)_\-\+\{\}\[\]\|:\<\>\.]+)/?extra$
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.