Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Mahir41's avatar

My local project is not working on VPS

Hi, I am using Ubuntu 18.04.4 LTS on my computer. Also, I use Ubuntu on my VPS too. While I am working locally It seems okay. When I upload my files to VPS via FTP, Only my index is working. Other pages give 404 error.

I know using FTP is not a very good way to upload local files to live server but I couldn't understand using a deploy extension. I am using VS Code by the way. If you can help me to configure deployment tools to I will be very pleased. Thanks.

0 likes
7 replies
siangboon's avatar

perhaps double check the .htaccess file and permission is configured accordingly...

mix5003's avatar

if i remember correctly. on Ubuntu after install apache it not enable mod_rewrite by default so you should do it yourself. and may be add AllowOverride All to your apache config to enable .htaccess for config mod_rewrite

Mahir41's avatar

Unfortunately, They didn't work. I deleted everything. Install laravel project to VPS, and upload public, resource and routers folders via FTP. Now my index seems okay. But other pages start to giving 404 Not Found like below.

Not Found The requested URL was not found on this server.

Apache/2.4.29 (Ubuntu) Server at mahiryildizhan.com Port 80

Tray2's avatar

Have you run sudo a2enmod rewrite on your VPS?

siangboon's avatar

it won't help by repeating the same installation steps without knowing the root cause... the chance is the .htaccess is not working accordingly...

when you say it didn't work better list down what had you did and what didn't work.. and what are the errors so others can help you.... you are wasting people time and your own time as well...

Mahir41's avatar

It seems yes. when do it again, it says "Module rewrite already enabled"

Mahir41's avatar
Mahir41
OP
Best Answer
Level 1

I solved it. I added the below lines to my apache config file on VPS.

Rewrites for pretty URLs, better not to rely on .htaccess.

<Directory /path/to/our/public>
    <IfModule mod_rewrite.c>
        Options -MultiViews
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
    </IfModule>
</Directory>

Please or to participate in this conversation.