Mapping several URLs to one login page My htaccess has this block in it:

RewriteRule ^login$ _user/login.php
RewriteRule ^login\.php$ _user/login.php
RewriteRule ^_user/login$ _user/login.php
RewriteRule ^_user/login\.php$ _user/login.php


How do I consolidate this block? The objective is to point to _user/login.php regardless of where on the server it's called from.
The last rule is completely superfluous, but harmless: it just maps the desired URL to itself.

The four cases can be combined into one rule:

RewriteRule ^(_user/)?login(\.php)?$ _user/login.php


In a regular expression, (something)? makes the something optional.  That is, whether the URL starts with _user/ or not, and whether the URL ends with .php or not, it will get mapped to the desired login page.