picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.81k stars 615 forks source link

404 Not found #55

Closed sebastian-ruiz closed 9 years ago

sebastian-ruiz commented 10 years ago

I installed Pico on my localhost, running PHP 5.4 When I try and go into a sub page I get the following error when accessing http://localhost/~Sebastian/github/pico/sub/

Not Found

The requested URL /Volumes/Secondary HD/Sebastian/Sites/github/pico/index.php was not found on this server.

The main page works fine though.

jbleuzen commented 10 years ago

If you downloaded Pico from the homepage, the .htacces needs to be created manually on your server.

Create one with the following :

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
inhumantsar commented 10 years ago

I'm also having trouble with 404s under Apache. I've got the .htaccess in place and permissions are fine all throughout. mod_rewrite is enabled and operational. See below.

$ tail /var/log/apache2/error.log
[Wed Sep 04 09:51:24 2013] [error] [client ::1] File does not exist: /var/www/keystone/maintenance, referer: http://localhost/
[Wed Sep 04 09:51:25 2013] [error] [client ::1] File does not exist: /var/www/keystone/favicon.ico
[Wed Sep 04 09:52:32 2013] [error] [client ::1] File does not exist: /var/www/keystone/maintenance, referer: http://localhost/

$ a2enmod rewrite
Module rewrite already enabled

$ cat /var/www/keystone/.htaccess 
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>

# Prevent file browsing
Options -Indexes
inhumantsar commented 10 years ago

I fixed this by changing the AllowOverride setup in Apache's site config to include the mod_rewrite directives http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

inhumantsar commented 10 years ago

If you have mod_rewrite enabled then AllowOverride All should do the trick. "FileInfo" is the one you want if you want to be specific.

Shaun Martin shaun@samsite.ca // 604 282 6361 [ linkedin http://ca.linkedin.com/pub/shaun-martin/a/583/32a/ ] [ wwwhttps://samsite.ca ] [ g+ https://plus.google.com/101809916798364924046/posts ] [ fbhttps://www.facebook.com/shaun.allen.martin]

On Thu, Sep 19, 2013 at 1:40 PM, guardadoe notifications@github.com wrote:

I have the same issue, I'm using WAMP. Could you please paste exactly what you added/changed?

I tried the following and none worked:

AllowOverride AuthConfig Indexes AllowOverride All

— Reply to this email directly or view it on GitHubhttps://github.com/gilbitron/Pico/issues/55#issuecomment-24771539 .

miragecraft commented 10 years ago

Ran into a similar issue when not installed in the root directory.

Fixed it by adding the line RewriteBase /subfolder/2nd-level after RewriteEngine On.

Snip1 commented 10 years ago

Did you enter appropriate data in the config.php file at $config['base_url'] = ''; // Override base URL (e.g. http://example.com) ?

miragecraft commented 10 years ago

That I did, I configured the base_url as well as adding the RewriteBase in .htaccess.

Also, I changed Options -Indexes to Options +FollowSymlinks -Indexes per suggestion from this closed issue, however that didn't fix my problem while the RewriteBase rule did, but I left it in there due to laziness. Just saying on the off-chance that it's somehow making everything work.

abely commented 10 years ago

There were actually two different issues being discussed in this thread:

  1. The OP had a 404 issue because pico was installed in a userdir. For rewrite to work properly, RewriteBase should be added in .htaccess. In his case, pico was located in /home/Sebastian/public_html/github/pico, and the RewriteBase line should be something like this:

    # right after RwriteEngine on
    RewriteBase /~Sebastian/github/pico/
  2. inhumantsar's issue was because he installed pico in /var/www/keystone, and by default, the site setting (usually /etc/apache2/sites-enabled/000-default) does not allow override for /var/www, thus .htaccess wouldn't work. So he had to change the site setting (most likely 000-default), and enable override for the /var/www directory, like this:

    AllowOverride FileInfo Options

Hope it helps.

dotku commented 10 years ago

RewriteBase works!!! http://www.weijinglin.name/labs/php/pico/sub/

Royaljerry commented 10 years ago

Now it all seems working for me in a subfolder. What I just discovered is that if you instal Pico in a subfolder and use Alias in httpd.conf (like me, who doesn’t like to use the default root for each project) Pico dies. But as soon as I moved the stuff to www/my_subfolder/ it suddenly started working. A strange, but hopeful situation.

alexandre-mbm commented 10 years ago

Way 1

pico-not-found

RewriteBase /Pico/?

@dotku, how is your RewriteBase?

Way 2

<VirtualHost *:80>
        DocumentRoot "/home/alexandre/Web/Pico"
        ServerName pico
        ServerAlias *.pico
        <Directory "/home/alexandre/Web/Pico">
                Options All Includes Indexes
        </Directory>
</VirtualHost>

I try to access http://pico/sub/page

And this results in "The requested URL /sub/page was not found on this server."

Solution! In way 2.

sudo a2enmod rewrite
sudo service apache2 restart
netomx commented 10 years ago

Have you tried enabling "AllowOverride All" in Apache?

Ernesto Villarreal

On Wed, May 21, 2014 at 4:17 AM, Alexandre Magno notifications@github.comwrote:

[image: pico-not-found]https://cloud.githubusercontent.com/assets/957501/3038077/a91f16ba-e0c8-11e3-94fc-4d4f5685c8ac.png

RewriteBase /Pico/?

— Reply to this email directly or view it on GitHubhttps://github.com/picocms/Pico/issues/55#issuecomment-43732230 .

alexandre-mbm commented 10 years ago

@netomx, the problem was lacks of the rewrite module.

netomx commented 10 years ago

Is that new? I don't recall enabling that on my server On May 21, 2014 12:48 PM, "Alexandre Magno" notifications@github.com wrote:

@netomx https://github.com/netomx, the problem was lacks of the rewrite module.

— Reply to this email directly or view it on GitHubhttps://github.com/picocms/Pico/issues/55#issuecomment-43790973 .

alexandre-mbm commented 10 years ago

Probably already is enabled.

alexandre$ sudo a2dismod 
[sudo] password for alexandre: 
Your choices are: alias auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex cgi deflate dir env mime negotiation php5 reqtimeout rewrite setenvif status
Which module(s) do you want to disable (wildcards ok)?

alexandre$ 

Press ENTER for deactivate none. rewrite is in my list above.