I have a wordpress site and a custom build app all on the same URL. I am looking to redirect all my CMS (custome app) URLs to a certain php controller file. Once redirected I am looking to remove the php file from the URL
e.g. www.website.com/cms redirects to www.website.com/backend.php/cms but the URL continues to display as www.website.com/cms
So far I have the following:
# Handle the custom App URLs
RewriteCond %{HTTP_HOST} ^(www.)?website.com/cms$
RewriteCond %{REQUEST_URI} !^backend.php/cms/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ backend.php/cms/$1
# Handle the Wordpress URLs by removing index.php
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
EDIT:
The problem is what I have does not work.
If I go to www.website.com/cms I get a 404.
If I go to www.website.com/backend.php/cms the URL does not change to www.website.com/cms, it stays as www.website.com/backend.php/cms
I am not great at .htaccess but think I am going down the correct route.