0

I am running apache and php and have a subdirectory, lets call it /test

When I go to domain.com/test I want it to run the index.php file that is in that directory and return the output.

Instead a 301 redirect is happening which redirects /test to /test/ (same url with a trailing slash) and then I get the output from index.php

I don't want their to be trailing slash when viewing the index.php file since no other urls on my site have trailing slashes

I've tried playing round with various apache directives in my htaccess file such as:

DirectorySlash Off
DirectoryIndexRedirect off
DirectoryIndex index.php
FallbackResource index.php

But so far all I've managed is to get a list of all the files in the directory or a 403 forbidden response.

Does anyone know how I can get it to run the index.php file without a trailing slash?

geoffs3310
  • 5,599
  • 11
  • 51
  • 104
  • does your php folder have an .htaccess file? and what is the contents of the file ? – Vidal Jun 15 '20 at 11:45
  • 1
    This might help: https://stackoverflow.com/questions/18625414/how-to-access-directorys-index-php-without-a-trailing-slash-and-not-get-301-red – Katie Jun 15 '20 at 11:45
  • Does this answer your question? [Remove trailing slash after directory with htaccess](https://stackoverflow.com/questions/71212482/remove-trailing-slash-after-directory-with-htaccess) – Stephen Ostermiller Jan 04 '23 at 10:45

0 Answers0