Jimmy
Jimmy

Reputation: 12517

How to resolve PHP page not found on LiteSpeed server

I have the following layout of a PHP files

├── classes/
├── migrations/
├── public/
│   ├── images/
│   ├── scripts/
│   ├── styles/
│   └── index.php
├── sample/
└── templates/

I wasn't sure how to put this on my server so I put the files from public into my public_html folder (which is what my cPanel already had).

Also, I put the other directories on the same level as public_html so as to maintain the regular structure of the project.

As such, I end up with this:

├── (some cPanel directory and files)
├── classes/
├── migrations/
├── public_html/
│   ├── images/
│   ├── scripts/
│   ├── styles/
│   └── index.php
├── sample/
├── templates/
└── (other cPanel directory and files)

Now, all other pages returns a HTTP status code 404 except the index page.

What am I doing wrong?

For reference, the project I'm trying to deploy is available at https://github.com/srv-twry/Quizzer.

Upvotes: 1

Views: 1094

Answers (1)

Progrock
Progrock

Reputation: 7485

Within your source there is no .htaccess, and it sounds as if redirection is missing.

You'll need to route appropriate URLs through your front controller - index.php.

With Apache style servers you could use modrewrite and a .htaccess file.

As a starting point, create a .htaccess with the rules below - you may need to tweak for your individual needs;

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [NC,L]

Code copied from Webmasters Stackexchange.

Upvotes: 1

Related Questions