.htaccess - Multiple RewriteRule -
i have multiple rewriterules in .htaccess file.
# enable rewriting rewriteengine on # rewrite profile urls # input: /user<userid> # output: /profile.php?id=<userid> rewriterule ^user(\d+)/?$ profile.php?id=$1 [l] # rewrite default redirect.php rewriterule .* redirect.php
every requests points redirect.php
i thought, [l] flag in first rewriterule, stop processing rule set.
if rewrite /user<userid>
/profile.php?id=<userid>
, rewrite other urls /redirect.php, try these 2 configuration directives:
rewriteengine on rewriterule ^user([a-za-z0-9_-]+)/?$ /profile.php?id=$1 [l] rewriterule .* /redirect.php
or:
rewriteengine on rewriterule ^user([a-za-z0-9_-]+)/?$ /profile.php?id=$1 [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* /redirect.php
Comments
Post a Comment