We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

new installation, mod rewrite not working

This is on an amazon EC2 instance. I go to the main directory URL and I see "mod rewrite is not enabled. Please enable rewrite module on your web server to continue."

[email protected]:/var/www/html$ uname -a
Linux ip-172-31-50-31 3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

I used phalcon-devtools to create a new project:

[email protected]:/var/www/html/KnowledgeBaseWeb$ find .
.
./index.html
./public
./public/img
./public/files
./public/css
./public/js
./public/index.php
./public/.htaccess
./public/temp
./app
./app/views
./app/views/index.volt
./app/views/index
./app/views/index/index.volt
./app/views/layouts
./app/config
./app/config/loader.php
./app/config/services.php
./app/config/config.php
./app/models
./app/controllers
./app/controllers/IndexController.php
./app/controllers/ControllerBase.php
./app/cache
./app/migrations
./.htaccess

Here is ./htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule  ^$ public/    [L]
    RewriteRule  ((?s).*) public/$1 [L]
</IfModule>

And here is ./public/.htaccess:

AddDefaultCharset UTF-8

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>

When I sudo a2enmod rewrite it says "module rewrite is already enabled."

Using php5.5.9-1ubuntu4.13 and apache 2.4.7-1ubuntu4.6 amd64. Phpinfo() reports phalcon 2.0.8

TIA!



85.5k

show us the apache config

check for

AllowOverride All


40.7k
Accepted
answer

Aha!

sudo nano /etc/apache2/apache2.conf

and changed

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

to

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

And it worked! Thanks!

I have same issue and try to do the above solution. But failed.

Only diffrence is I'm doing with Local system and Using Linux/Ubuntu 18.04. Do you need more details from myside?