core icon indicating copy to clipboard operation
core copied to clipboard

having index.php in subdirectory

Open ftheron15 opened this issue 4 years ago • 1 comments

Hi,

I don't know if it's an issue or if it's my bad, but I've a problem with the routing and the file .htaccess

I put my index.php in the directory /a/b and I want to redirect my request to this directory in the .htaccess. My request is GET http://localhost/myProject/users I follow the documentation without sucess.

.htaccess

RewriteEngine On
RewriteBase /a/b/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]

index.php

Flight::route('GET /users', array($UserController,'getAllUsers'));
Flight::start();

I found two solutions to debug it but I can't keep this. with the .htaccess like this

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ a/b/index.php [QSA,L]
  • Change the request
http://localhost/myProject/a/b/users
  • Put the test route on /*/users

index.php

Flight::route('GET /*/users', array($UserController,'getAllUsers'));
Flight::start();

Do you know how to :

  • request GET http://localhost/myProject/users
  • having my index file in directory /a/b

Thank you in advance

ftheron15 avatar Jan 14 '22 14:01 ftheron15

See this https://stackoverflow.com/questions/11784073/apache-rewrite-rule-to-redirect-all-request-to-subdirectory-containing-another https://stackoverflow.com/questions/28970616/rewrite-rule-in-subdirectory https://stackoverflow.com/questions/65109212/how-can-i-use-the-htaccess-file-to-rewrite-urls-for-a-subdirectory

mosababdo avatar Sep 06 '22 18:09 mosababdo

This seems addressed. If not, let's create another issue.

n0nag0n avatar Jan 03 '24 21:01 n0nag0n