I have two PHP files: profile.php
(accepts a u
value with an integer) and user.profile.php
. What I want to accomplish is this:
-
profile.php?u=1
should beexample.com/profile/1
. -
user.profile.php
shouldexample.com/profile/1/user
user.profile.php
also needs the same u
parameter value that profile.php
has. So here is what I wrote:
RewriteRule ^profile/(\d+)?$ profile.php?u=$1 [NC,L]
RewriteRule ^profile/(\d+)?$/users user.profile.php?u=$1 [NC,L]
The first part of that code works as intended. When I navigate to example.com/profile/1
, it shows the content that would be displayed when I navigate to example.com/profile.php?u=1
. However, the second line in that code throws a 500 Internal Server Error
. Is it not possible to create a virtual directory inside another one?