1
I have a file .htaccess that adds PATH_INFO in the index.php file (for the route system):
RewriteEngine On
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(?!index\.php(/.*|$))([a-zA-Z0-9\-\/.]+)$ index\.php/$1 [QSA,L]
This works perfectly with my route system which is in index.php
The problem is I want to use third-party software (3rdparty) at the same time as the route system, so I did this on .htaccess:
RewriteEngine On
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(?!3rdparty/.*|index\.php(/.*|$))(.*)$ 3rdparty/$1 [QSA,L]
This Rewriterule tries to access files that are in "3rdparty" folder rewriting to not display the 3rdparty url, but if the file or folder does not exist within 3rdparty then the system must use the routes.
Example, if you access http://localhost/folder1/ will show the contents of the file /var/www/3rdparty/folder1/, but if the file does not exist in the folder 3rdparty then you should use the route system.
Folder structure
This is just one example
project
├── index.php
├── .htaccess
└── 3rdparty
├── folder1
└── folder2
├── file1.html
└── file2.html
What I want is to access other PHP files without having to type something like http://localhost/3rdparty/something...
Examples (see folder structure above):
http://example/project/folder1will show the content ofhttp://example/project/3rdparty/folder1http://example/project/folder2will show the content ofhttp://example/project/3rdparty/folder2/http://example/project/folder2/file1.htmlwill show the content ofhttp://example/project/3rdparty/folder2/file1.htmlhttp://example/project/folder2/file2.htmlwill show the content ofhttp://example/project/3rdparty/folder2/file2.htmlhttp://example/project/folder3/file3.html(url not existing in the 3rdparty folder) will display the content ofhttp://example/project/index.php/folder3/file3.html
How can I do this?