I’ve got two apps running on the same website. One app is a proprietary framework, and the other is WordPress. Both apps were designed to funnel everything through a file named index.php, which I guess you might consider a “bootstrap”, yes? Well, there can’t be two index.php files, so I renamed one to brain_index.php. Brain (the proprietary framework) only needs to handle a few routes, but there all pointed at the same file, so I just want to know if there is a way to consolidate the rewrite rules, or if there is a better way to write this:
# URLs routed to Brain
RewriteRule ^$ /brain_index.php [L]
RewriteRule ^team$ /brain_index.php [L]
RewriteRule ^rentals.*$ /brain_index.php [L]
RewriteRule ^real_estate.*$ /brain_index.php [L]
RewriteRule ^contact$ /brain_index.php [L]
# If file or directory does not exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Route to Wordpress
RewriteRule .* index.php/$0 [PT,L]
Maybe I should have been more clear, and also provided the complete .htaccess. My rewrite rules are working, I just wanted to know if there was a better way to route multiple URIs to the same script. See, everything pointed at brain_index.php is special, and then everything else goes to WordPress. Here’s the full working .htaccess:
# MAKE SURE TO LEAVE DENY LIST AT VERY TOP --
# END DENY LIST (DO NOT REMOVE THIS LINE) --
Options -Indexes
RewriteEngine On
RewriteBase /
# Remove WWW
#RewriteCond %{HTTP_HOST} !^your-domain\\.com$ [NC]
#RewriteCond %{HTTPS} !=on
#RewriteRule ^(.*)$ http://your-domain.com/$1 [L,R=301]
RewriteRule ^(app|tests|vendor) - [F,L]
# URLs routed to Brain
RewriteRule ^$ /brain_index.php [L]
RewriteRule ^index\\.php$ /brain_index.php [L]
RewriteRule ^rentals.*$ /brain_index.php [L]
RewriteRule ^real_estate.*$ /brain_index.php [L]
RewriteRule ^contact$ /brain_index.php [L]
RewriteRule ^notice_to_vacate$ /brain_index.php [L]
# If file or directory does not exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Route to Wordpress
RewriteRule .* wp_index.php/$0 [PT,L]