Cake PHP 3 | Internal Server Error 500 - .htaccess

On the localhost it is running. But when I upload it, its throwing an 500 error.
I checked:
mod_rewrite (loaded - phpinfo(8))
extension intl (enabled)
I tried:
Deleting all the cache files
Thats my .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
Errorlog of PHP:
[Sun Jan 17 11:04:02 2016] [warn] RSA server certificate wildcard CommonName (CN) `*.webpack.hosteurope.de' does NOT match server name!?
Any ideas?

So at the end it was pretty simple and stupid, but maybe it will help someone.
My Webhosting was using PHP 5.3 - Update to 5.6 and e´voila!

Related

Restricting RewriteRule to ignore certain folders

I have a basic Rewrite rule defined in the root of my website, in an .htaccess file:
<IfModule mod_rewrite.c>
# http://www.generateit.net/mod-rewrite/index.php
# Tell PHP that the mod_rewrite module is ENABLED.
SetEnv HTTP_MOD_REWRITE On
RewriteEngine on
RewriteRule ^([^/]*)/$ category.php?cat=$1 [L]
RewriteRule ^([^/]*)/([^/]*)/$ post.php?cat=$1&post=$2 [L]
RewriteRule ^blog-([^/]*).php$ default.php?page=$1 [L]
</IfModule>
I have 2 sites hosted on the same folder structure:
DIR: example2.com
file: category.php
file: default.php
file: post.php
So the rewrite rule will redirect e.g.
example.com/post.php?cat=general-ledger&post=gl-journals-volumes
to:
example.com/general-ledger/gl-journals-volumes/
However, I have installed Wordpress in a folder called ddc on example2, but when I visit:
example2.com/ddc/wp-admin/user/
I can't view it, as the system thinks it's trying to view a rewritten page.
Is there any way I can stop the rewrite rule from firing for specific directories?
I have tried:
RewriteCond %{REQUEST_URI} !^/(example2.com|ddc)/?(.*)$ [NC]
But it made no difference. Furthermore, the error log shows this when I try to access the folder:
[Mon Jan 16 22:39:53.365334 2017] [autoindex:error] [pid 28997]
[client my_ip_address_here:53652] AH01276: Cannot serve directory
/home/oracle36/public_html/example2.com/ddc/wp-admin/user/: No
matching DirectoryIndex (default.php) found, and server-generated
directory index forbidden by Options directive
Your rewrite rules are not the problem. They only affect URLs with directories of one or two levels. Your problem is that you don't have index.php set up as a directory index, so there is nothing for Apache to serve from the WordPress directory. Add this to your .htaccess:
DirectoryIndex default.php index.php
I am adding default.php to that because the error message shows you have that set up already, and then adding index.php to it as another option, to support WordPress. You can remove your RewriteCond.

Laravel 4.2 project not working after uploading - public folder not visible in browser

I've created a laravel project which is working fine on localhost and my hosting server but when I upload it on my client's server it just doesn't work (he's using bluehost).
When I open the URL which is pointing to /public folder, it should display the homepage. Instead it is showing the listing of all files and folders (except public folder).
When I try to open myurl.com/public or myurl.com/public/index.php in browser, it gives following error:
Forbidden
You don't have permission to access /license/public/ on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
I can see public folder via FTP and I've changed permissions for /app/storage to 777
Here is my public/.htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I've checked my /public/error_log, its showing following error:
[21-Aug-2015 09:06:01] PHP Fatal error: require() [<a href='function.require'>function.require</a>]: Failed opening required '__DIR__/../bootstrap/autoload.php' (include_path='.:/usr/lib64/php:/usr/share/pear') in /home6/parentv3/public_html/eldercareapp/license/public/index.php on line 21
Any help?
Well the problem is with your PHP version. If you see your PHP Version, you might get what is wrong with your application. You must use version greater than PHP 5.5
Ok, I had contacted client's hosting company and asked them to upgrade PHP version. They took a couple of days and upgraded PHP to 5.5.
But the problem was still there even after updating PHP. I wasn't able to access /public folder so the problem was somewhere else. After some searching and trying I've found a solution.
The problem was actually in my /public/.htaccess file. I've added just one line in my .htaccess and it solved the problem: Options +FollowSymLinks
My updated .htaccess in /public now looks like:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
Options +FollowSymLinks
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Cheers
Changing permissions to 777 is a terrible idea because it will be vulnerable, instead try with sudo chmod -R 775 project/ where project is the name of your project's folder, then do the next sudo chown -R $USER:$USER project/ to make the project's folder be owned by your user, finally, if you haven't done it, cd into the project's folder and run composer install

Cakephp 2.x URL rewriting is not properly configured on your server

I think somehow most of us had a trouble with .htaccess I d'like to know if someone can help me.
Opensuse 12.3 :
Code:
Linux linux-hyo0.site 3.7.10-1.16-desktop #1 SMP PREEMPT Fri May 31 20:21:23 UTC 2013 (97c14ba) x86_64 x86_64 x86_64 GNU/Linux
I d'like to install Cakephp on my machine but I have an error on my webpage saying that "
Code:
URL rewriting is not properly configured on your server.
"
my /etc/sysconfig/apache2 file as this :
Code:
APACHE_MODULES="authz_host actions alias auth_basic authz_groupfile authn_file authz_user autoindex cgi dir include log_config mime negotiation setenvif status userdir asis imagemap php5 reqtimeout authz_default rewrite"
and the /etc/apache2/sysconfig.d/loadmodule.conf as this line at the end
Code:
LoadModule rewrite_module /usr/lib64/apache2/mod_rewrite.so
I did also change my file etc/apache2/defaul-server.conf
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory "/srv/www/htdocs">
Options Indexes FollowSymLinks MultiViews
AllowOverride ALL
Order Allow,Deny
Allow from all
</Directory>
Any help?
on app/webroot
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
and on app/
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
This is quite an old question but maybe this answer is relevant for you Google users out there:
Did you change the View/Layouts/default.ctp?
This is what happens with this warning:
The warning is set in a div in View/Pages/home.ctp
In home.ctp only sets the warning when the file app/webroot/css/cake.generic.css exists
In the standard default.ctp layout, the stylesheet /css/cake.generic.css is loaded
In cake.generic.css the div with the warning is.... hidden!!!
So what happens when the default home page loads: it tries to load the cake.generic.css style sheet, which succeeds when mod_rewrite is configured correctly. So then the warning is hidden. If it fails to load the style sheet, the warning will stay visible.
This warning pops up, in short, when either there is a problem with mod_rewrite and htaccess, or you changed the layout so that the cake.generic.css is no longer loaded...
First check if you even try to load the stylesheet. Does it show up in your F12 console?
After hours trying to track down the problem I finally found that my .htaccess file never existed in the first place. I copied the following code into a new .htaccess file and hey presto.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Let me first say: I HATE CAKEPHP!!!!
I just spent hours working on this issue.
I learned that cake tests URL rewrite by checking for app/webroot/css/cake.generic.css
Make sure that exists.
My solution came after I checked the apache error_log and saw it complaining about not being able to find http:/myproject/css. Well, there is no css directory there by default. I created a link (ln -s app/webroot/css) and it solved Cake's problem.
If you got this error after new installation of Cakephp and you do not changed any of the files(css files or cake.generic.css) then do the following:
sudo a2enmod rewrite
sudo service apache2 restart
sudo nano /etc/apache2/sites-available/000-default.conf
Look for “DocumentRoot /var/www/html” and add the following lines directly below:
AllowOverride All
sudo service apache2 restart
Make sure you change all AllowOverride None to AllowOverride All
I have this problem and solve this copying the lines of cakebook:
http://book.cakephp.org/2.0/en/installation/url-rewriting.html
There is also a .htaccess file in the root folder, i.e. /.htaccess. This may not have been copied across as it's hidden by default by most operating systems.
Try adding this as the contents of /.htaccess and checking it makes it to the web server.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
There's more explanation at http://book.cakephp.org/2.0/en/installation/url-rewriting.html
There’s two solutions:
1) Either set the DocumentRoot in your Apache configuration file to the app/webroot/ directory, and CakePHP will use the .htaccess file there.
2) Place a .htaccess file in the root of your application, as by default I don’t think one gets created if you use the CakePHP console to generate an app. That .htaccess file should look this this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>

500 Internal Server Error on Subversion Commit / USVN / Raspberry Pi

I am using User-Friendly SVN on my Raspberry Pi. The Pi is running with Debian Wheezy.
Creating repositories is working and I can checkout and update the repository without any problem. But when I create a file, add it to the repository and try to commit, I get this message:
svn: E175002: Commit failed (details follow):
svn: E175002: Server sent unexpected return value (500 Internal Error) in response to POST request for '/usvn/svn/test/!svn/me'
svn: E175002: Your commit message was left in a temporary file:
svn: E175002: '/svntest/test/svn-commit.tmp'
There is nothing in the error.log, but in the access.log I can find this:
192.168.10.34 - - [22/Sep/2013:10:23:14 +0200] "OPTIONS /usvn/svn/test/trunk HTTP/1.1" 401 653 "-" "SVN/1.7.5 neon/0.29.6"
192.168.10.34 - admin [22/Sep/2013:10:23:17 +0200] "OPTIONS /usvn/svn/test/trunk HTTP/1.1" 200 1347 "-" "SVN/1.7.5 neon/0.29.6"
192.168.10.34 - admin [22/Sep/2013:10:23:18 +0200] "POST /usvn/svn/test/!svn/me HTTP/1.1" 500 548 "-" "SVN/1.7.5 neon/0.29.6"
The SVN-Path has read and write access for www-data.
What can I do?
I ran into this same problem and wasn't satisfied with py3r3str's fix. I figured out if I changed the usvn/public/.htaccess file I could exclude the repos from the rewrite rule and this fixed the problem for me:
<Files *.ini>
Order Allow,Deny
Deny from all
</Files>
php_flag short_open_tag on
php_flag magic_quotes_gpc off
RewriteEngine on
#RewriteCond
RewriteBase "//usvn/"
RewriteRule ^svn/ - [L,NC] #this is the rule I added to fix the 500 errors
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Are you on 64 bit OS ?
I'm facing the same error with win7 64Bit and not with win7 32bit.
Try remove tortoise 64 and install tortoise SVN for 32 bit OS :
http://www.oldversion.fr/windows/tortoisesvn-1-6-10
I have same issue.
I've notice that /svn/test/!svn/me request is catch by usvn web application instead of svn server.
My solution of this problem is to change subdomain of svn server that works for me.
Cheers
I could not avoid the error in the description method of htaccess of allen.
So I fix this.
<Files *.ini>
Order Allow,Deny
Deny from all
</Files>
php_flag short_open_tag on
php_flag magic_quotes_gpc off
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /usvn
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule !^svn\/ index.php [L]
</IfModule>

FreeBSD Server .htaccess issues

Server Details:
FreeBSD
PHP Version 4.3.11
Apache
Appache Modules:
mod_throttle, mod_php4, mod_speedycgi, mod_ssl, mod_setenvif, mod_so, mod_unique_id, mod_headers, mod_expires, mod_auth_db, mod_auth_anon, mod_auth, mod_access, mod_rewrite, mod_alias, mod_actions, mod_cgi, mod_dir, mod_autoindex, mod_include, mod_info, mod_status, mod_negotiation, mod_mime, mod_mime_magic, mod_log_config, mod_define, mod_env, mod_vhost_alias, mod_mmap_static, http_core
The issue I am having is when ever I write any kind of code in the .htaccess file, it throws a 500 Internal error
I am simply trying to rewrite url's and am using the exact code that wordpress creates for me and even tried custom code used before on previous servers and it still does not work.
WordPress created code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /lobster-tail-blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /lobster-tail-blog/index.php [L]
</IfModule>
# END WordPress
And even a simple thing like this throws the error:
<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>
Anyone know of any fixes or why this is causing this error? I have the mod_rewrite module loaded
You should take a look at AllowOverride it is probably turned off try something like this:
<Directory /path/to/www/root/>
AllowOverride All
</Directory>

Resources