admin管理员组

文章数量:1127898

-This problem does not happen on the deployed Heroku application but only on the local domain. -index.php and .htaccess are stored in (root)/public

My issue is that XAMPP doesn't seem to read .htaccess and when I try to access domain.local it doesn't redirect to index.php and it fully exposes the folders and files of the application.

When I try to access the domain, arcadia-2025-lastrun.local, I find a list of folders and all the files present in the application, instead of being redirected to index.php. I want to emphasize that index.php and .htaccess are located in (root)/public/

I made the local domain beforehand and the VirtualHost is as follows:

<VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs\ARCADIA-2025-LASTRUN"
    ServerName ARCADIA-2025-LASTRUN.local
</VirtualHost>

I have this as .htaccess — it causes no issue when deployed to Heroku:

RewriteEngine On

#accept loading of actual files and directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#send everything else to the index page
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]

-This problem does not happen on the deployed Heroku application but only on the local domain. -index.php and .htaccess are stored in (root)/public

My issue is that XAMPP doesn't seem to read .htaccess and when I try to access domain.local it doesn't redirect to index.php and it fully exposes the folders and files of the application.

When I try to access the domain, arcadia-2025-lastrun.local, I find a list of folders and all the files present in the application, instead of being redirected to index.php. I want to emphasize that index.php and .htaccess are located in (root)/public/

I made the local domain beforehand and the VirtualHost is as follows:

<VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs\ARCADIA-2025-LASTRUN"
    ServerName ARCADIA-2025-LASTRUN.local
</VirtualHost>

I have this as .htaccess — it causes no issue when deployed to Heroku:

RewriteEngine On

#accept loading of actual files and directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#send everything else to the index page
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
Share Improve this question asked Jan 8 at 15:52 IcyAukIcyAuk 1
Add a comment  | 

1 Answer 1

Reset to default 0

Problem solved.

XAMPP does not automatically look for /public like Heroku seems to do.

Add your /public folder in httpd-vhosts.conf

<VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs\ARCADIA-2025-LASTRUN/public"
    ServerName ARCADIA-2025-LASTRUN.local
    <Directory "C:/xampp/htdocs/ARCADIA-2025-LASTRUN/public">
        Options -Indexes
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

本文标签: