picocms / Pico

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

500 internal server error when accessing /sub/pages #226

Closed Lesik closed 9 years ago

Lesik commented 9 years ago

Hey, I would like to config Pico to use some other folder for content. I found in https://github.com/picocms/Pico/pull/211 that content_dir contains the content directory. Though setting $config['content_dir'] = 'content'; does not seem to do the trick (I only see the menu, no content).

Also, this is undocumented, at least I found nothing on the docs. It's important in my opinion, would add an official way of changing the directory name, as different people use different folder structures to organize their servers.

theshka commented 9 years ago

I'm unable to reproduce this.

I have a feeling you didn't rename the config.php.template to config.php for the changes to take effect. If this doesn't resolve your issue; please provide more details, and I will assist you further.

Edit: I've changed the wording to more explicitly state how to override the default settings in the config.php.template file. Commit: 5744a5650ab73129611f357d7b995f085a79e433

Lesik commented 9 years ago

Oh man, I'm sorry. I didn't notice content_dir was already set in the config.php, so I set it twice. Yes, I did rename config.php.template, I'm not quite that stupid ;-) Sorry, my bad, no issue here.

I face a different issue though, I can't access any files in the subdirectories, for example /sub. If you want another page within the sub folder, simply create a text file with the corresponding name (e.g. content-sample/sub/page.md) and will be able to access it from the URL http://yoursite.com/sub/page. Doesn't work for me, I just get a blank page. Tried setting chmod to 777, didn't help. Should I open a different issue for that?

theshka commented 9 years ago

Sorry, @Lesik ,

Again, I'm unable to reproduce that issue. Have a look at my test.

A blank page usually means you have error reporting suppressed in your php.ini or .htaccess Check the servers' error log and respond with the message it is giving.

Lesik commented 9 years ago

And again this issue was my fault. I'm starting to feel embarrassed. I though I copied the .htaccess file when transferring my local folder to the server, but because "hidden files" were turned off, Nautilus (my file manager) didn't copy that file over.

6. That's it. Tweak the .htaccess file if required. With the default .htaccess (from this repo) I get a 500 server error accessing /sub. Could you share your .htaccess for comparison?

theshka commented 9 years ago

This is the one my test case is using, just the default .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

Depending on your setup, you could try using RewriteBase

Lesik commented 9 years ago

I have the same one. I get this error when accessing /sub:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

I don't have SSH access on my server, just SFTP (German hoster 1und1.de), so can't check logs. Any idea what could be wrong anyways..? :(

theshka commented 9 years ago

I'm not familiar with the host, and It's hard for me to say. I know that 500 errors are typical of a .htaccess misconfiguration. :stuck_out_tongue_winking_eye:

If nothing else, try submitting a ticket to your host. It could be a misconfiguration of their Apache install, who knows? Having access to the log file could give you crucial information.

Lesik commented 9 years ago

I know how difficult it is to deal with inexperienced people, thanks for having patience with me. Webdev isn't my field, I just want to host my Java projects with a simple CMS.

theshka commented 9 years ago

It's no problem. I'm no master myself, and this helps me just as much as it helps you.

Have you tried this in a local environment?

theshka commented 9 years ago

You may get more information from these issues as well: #100, #22

Lesik commented 9 years ago

RewriteBase / did it, thanks. I wonder what the value of RewriteBase was before, shouldn't / be default? Anyways, thanks for your help :)

theshka commented 9 years ago

Happy Pico'ing! :+1: