How do I get this behavior from Apache?

Discussion in 'Apache' started by markosjal, Jul 12, 2021.

  1. #1
    I was using PHP integrated development server and everything worked great. Then I installed XAMPP on the same Windows computer only to find that my URLs without trailing slash are not respected in XAMPP. I DO NOT WANT ANY REDIRECTS!

    I then found a partial solution, however I do not know how to apply that solution to dynamic folder names.

    So I am looking to reproduce the behavior I got with the PHP development server which allowed me to load for example:
    http://example.com/directory (NO TRAILING SLASH!)
    (this would load http://example.com/directory/index.php)

    Then I found I can do the following , which is now in my .htaccess and working for those directories

    RewriteEngine On
    RewriteRule ^eSCL/ScannerStatus/?$ eSCL/ScannerStatus/index.php [L]
    RewriteRule ^eSCL/ScannerCapabilities/?$ eSCL/ScannerCapabilities/index.php [L]
    RewriteRule ^eSCL/ScanJobs/?$ eSCL/ScanJobs/index.php [L]
    RewriteRule ^eSCL/Scans/?$ eSCL/Scans/index.php [L]
    RewriteRule ^eSCL/Scans/NextDocument/?$ eSCL/Scans/NextDocument/index.php [L]
    # RewriteRule ^eSCL/ScanJobs/.*/?$ eSCL/ScanJobs/.*/index.php [L]
    # RewriteRule ^eSCL/ScanJobs/.*/NextDocument/?$ eSCL/ScanJobs/.*/NextDocument/index.php [L]
    Code (markup):
    I then tried to use the last two lines (commented out now) to accommodate the dynamic folder names that are generated (.* above).

    So my only remaining question is how can I make this rule apply to ALL folders and subfolders or to a folder with a dynamically generated name
     
    Last edited by a moderator: Jul 13, 2021
    markosjal, Jul 12, 2021 IP