I have these rules and I can't figure out why one of them won't work:
RewriteEngine On
RewriteBase /
Options +FollowSymlinks
Options -MultiViews
Options -Indexes
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^error/([^/.]+)/([^/.]+)$ /pages/error.php?$1=$2 [NC,R]
RewriteRule ^([^/.]+)$ index.php?user=$1 [NC,L]
RewriteRule ^([^/.]+)/.* index.php?$0 [PT]
RewriteRule ^error/.* error.php/?$0 [PT]
Rule 1 works, echo $_GET['user']
then I get results
Rule 2 works as well. If I do a print_r($_SERVER['REQUEST_URI'])
then I get what ever is after .com/
.
so That makes me think that its catching correctly, and if I do a as well.
So those rules seem to be working... but now if I enter
domain.com/error/access/notallowed
then I get a Not Found
error, so that means that my Rule 3 that wants to catch anything that starts with error
isn't working.
Any ideas on what may be causing this behavior?
EDIT: updated rules based on answer
RewriteRule ^([^/.]+)$ index.php?user=$1 [NC,L]
RewriteCond %{REQUEST_URI} ^/error/?
RewriteRule ^([^/.]+)/?.* index.php?$1 [PT]
RewriteRule ^(error/?.*)$ /_msp/pages/error.php/?$1