.htaccess — CAKE PHP v2 — Доступ запрещен — 400 неправильных запросов, наш браузер отправил запрос, который этот сервер не может понять

Меня вызвали, чтобы поддержать проект в торт php.
Заказчик отлично запустил проект на своем хостинге и случайно удалил все содержимое, после чего мне позвонили, чтобы повторить развертывание на новом хостинге.

Я выполнил стандартную процедуру, скопировал все файлы в каталог FTP и исправил новые связи с базой данных в файлах database.php и wordpresscomponent.php (поскольку проект имеет интеграцию со страницей на wordpress), а также в wp -config.php собственная папка, которая запускает другое приложение в WordPress.

Сначала у меня были довольно открытые вопросы на сайте, неработающие изображения и формы.
Я понял, что мне не хватает разрешений для временной папки (после загрузки файлов в новый FTP-провайдер), а затем дал разрешение 755 для временной папки в ядре внутренней папки и для папки «files» в \ app \ webroot \ Файлы также поняли, что мои Filezilla поврежденные файлы и изображения для загрузки, а затем пришлось переделывать всю загрузку новых файлов. И сайт вернулся к работе.

Но у меня проблема в дизайне административной панели.
Существует вкладка, которая регистрирует объекты типа «продукты» и «газета», которые представляют собой текст с изображениями (представляющие продукты, которые идут на странице сайта).

Всякий раз, когда я редактирую информацию этой страницы, я получаю ошибку, упомянутую в этом разделе.
«ошибка 400, неверный запрос

Ваш браузер отправил запрос, который этот сервер не может понять. «

ОБНОВИТЬ:
Я заметил, что ошибка связана с таблицей, которая загружается в информацию об объекте продукта.
Если я редактирую продукт и исключаю эту таблицу, либо создаю новый продукт, ошибка показывает другое, что, по-видимому, связано только с функцией, загружающей изображения:

Неустранимая ошибка: класс ‘imagick’ не найден в /home/serramar.coop.br/public_html/app/Plugin/upload/Model/Behavior/UploadBehavior.php в строке 829

атрибут питания из журнала

#

Журнал ошибок хост-сервера:

[Tue Mar 22 03:35:19 2016] [error] [client 189.110.14.241] ModSecurity:      Access denied with code 400 (phase 2). Pattern match "\\\\%(?!$|\\\\W|[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})" at ARGS:data[Product][nutrition]. [id "950107"] [msg "URL Encoding Abuse Attack Attempt"] [severity "WARNING"] [hostname "serramar.coop.br"] [uri "/admin/products/edit/7"] [unique_id "aqC917rtAAIAAENAEKkAAAA2"]

[Tue Mar 22 03:35:19 2016] [error] [client 189.110.14.241] ModSecurity: Audit log: Failed to lock global mutex: Bad file descriptor [hostname "serramar.coop.br"] [uri "/admin/products/edit/7"] [unique_id "aqC917rtAAIAAENAEKkAAAA2"]

[Tue Mar 22 03:35:19 2016] [error] [client 189.110.14.241] ModSecurity: Audit log: Failed to unlock global mutex: Bad file descriptor [hostname "serramar.coop.br"] [uri "/admin/products/edit/7"] [unique_id "aqC917rtAAIAAENAEKkAAAA2"]

#

/ public_html htaccess:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule    ^$ app/webroot/    [L]
RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

#

/ public_html / app htaccess:

<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteBase /webroot/
RewriteRule    ^$    webroot/    [L]
RewriteRule    (.*) webroot/$1    [L]
</IfModule>

#

/ public_html / app / webroot htaccess:

<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteBase /app/webroot/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

#

Product Controller.php в public_html / app / Controller / ProductsController.php

<?php
App::uses('AppController', 'Controller');
/**
* Products Controller
*
* @property Product $Product
*/
class ProductsController extends AppController {

public function beforeFilter() {
$directory = $this->webroot . 'files' . DS . 'product' . DS . 'picture' . DS;
$this->set('directory', $directory);
$this->set('tabelanutricional', $this->Product->getTabelaNutricional());
return parent::beforeFilter();
}

/**
*  Layout
*
* @var string
*/
public $layout = 'bootstrap';

/**
*
*
* @var array
*/
public $helpers = array('TwitterBootstrap.BootstrapHtml', 'TwitterBootstrap.BootstrapForm', 'TwitterBootstrap.BootstrapPaginator');
/**
* Components
*
* @var array
*/
public $components = array('Session');

public function index($line = null){
$this->layout = 'default';
$this->Product->recursive = 0;
$this->redirect('/#produtos');
}

public function serramar(){
$this->layout = 'default';
$this->Product->recursive = 0;
$products = $this->Product->find('all', array('conditions'=>array('Product.line'=>'serramar')));
$this->set('products', $products);
$this->set('page', 'produtos');
$this->set('subtitle', 'Conheça a linha de produtos feitos com o mais delicioso leite das fazendas, um privilégio que você pode ter todos os dias em sua casa');
}

public function maringa(){
$this->layout = 'default';
$this->Product->recursive = 0;
$products = $this->Product->find('all', array('conditions'=>array('Product.line'=>'maringa')));
$this->set('products', $products);
$this->set('page', 'produtos');
$this->set('subtitle', 'A tradição que põe um sabor especial na sua mesa.');
}

public function milkmix(){
$this->layout = 'default';
$this->Product->recursive = 0;
$products = $this->Product->find('all', array('conditions'=>array('Product.line'=>'milkmix')));
$this->set('products', $products);
$this->set('page', 'produtos');
$this->set('subtitle', 'A saborosa bebida láctea da Serramar em novos e deliciosos sabores: ameixa e laranja. Saiba mais!');
}

public function serramar_all($id = null){
$this->layout = 'ajax';
$products = $this->Product->find('all', array('conditions'=>array('Product.line'=>'serramar')));
$this->set('products', $products);
$this->set('id', $id);
}
public function milkmix_all($id = null){
$this->layout = 'ajax';
$products = $this->Product->find('all', array('conditions'=>array('Product.line'=>'milkmix')));
$this->set('products', $products);
$this->set('id', $id);

}
public function maringa_all($id = null){
$this->layout = 'ajax';
$products = $this->Product->find('all', array('conditions'=>array('Product.line'=>'maringa')));
$this->set('products', $products);
$this->set('id', $id);

}

/**
* index method
*
* @return void
*/
public function admin_index() {
$this->Product->recursive = 0;
$this->set('products', $this->paginate());
}

/**
* view method
*
* @param string $id
* @return void
*/
public function admin_view($id = null) {
$this->Product->id = $id;
if (!$this->Product->exists()) {
throw new NotFoundException(__('Invalid %s', __('product')));
}
$this->set('product', $this->Product->read(null, $id));
}

/**
* add method
*
* @return void
*/
public function admin_add() {
if ($this->request->is('post')) {
$this->Product->create();
if ($this->Product->save($this->request->data)) {
$this->Session->setFlash(
__('The %s has been saved', __('product')),
'alert',
array(
'plugin' => 'TwitterBootstrap',
'class' => 'alert-success'
)
);
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(
__('The %s could not be saved. Please, try again.', __('product')),
'alert',
array(
'plugin' => 'TwitterBootstrap',
'class' => 'alert-error'
)
);
}
}
}

/**
* edit method
*
* @param string $id
* @return void
*/
public function admin_edit($id = null) {
$this->Product->id = $id;
if (!$this->Product->exists()) {
throw new NotFoundException(__('Invalid %s', __('product')));
}
if ($this->request->is('post') || $this->request->is('put')) {
if ($this->Product->save($this->request->data)) {
$this->Session->setFlash(
__('The %s has been saved', __('product')),
'alert',
array(
'plugin' => 'TwitterBootstrap',
'class' => 'alert-success'
)
);
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(
__('The %s could not be saved. Please, try again.', __('product')),
'alert',
array(
'plugin' => 'TwitterBootstrap',
'class' => 'alert-error'
)
);
}
} else {
$this->request->data = $this->Product->read(null, $id);
}

}

/**
* delete method
*
* @param string $id
* @return void
*/
public function admin_delete($id = null) {
if (!$this->request->is('post')) {
throw new MethodNotAllowedException();
}
$this->Product->id = $id;
if (!$this->Product->exists()) {
throw new NotFoundException(__('Invalid %s', __('product')));
}
if ($this->Product->delete()) {
$this->Session->setFlash(
__('The %s deleted', __('product')),
'alert',
array(
'plugin' => 'TwitterBootstrap',
'class' => 'alert-success'
)
);
$this->redirect(array('action' => 'index'));
}
$this->Session->setFlash(
__('The %s was not deleted', __('product')),
'alert',
array(
'plugin' => 'TwitterBootstrap',
'class' => 'alert-error'
)
);
$this->redirect(array('action' => 'index'));
}
}

-2

Решение

Проблема была решена !!!

После восстановления логов снова:

[Tue Mar 22 22:30:26 2016] [error] [client 200.100.30.37] ModSecurity: Access denied with code 400 (phase 2). Pattern match "\\\\% ($ | \\\\ W | [0-9a-fA-F] {2} | u [0-9a-fA-F] {4}!)" At ARGS: date [Product] [nutrition]. [Id "950107"] [msg "URL Encoding Abuse Attack Attempt"] [severity "WARNING"] [hostname "serramar.coop.br"] [uri "/ admin / products / edit / 7"] [unique_id "RjzfCLrtAAIAAMynquEAAABM" ]

[Tue Mar 22 22:30:46 2016] [error] [client 200.100.30.37] ModSecurity: Access denied with code 400 (phase 2). Pattern match "\\\\% ($ | \\\\ W | [0-9a-fA-F] {2} | u [0-9a-fA-F] {4}!)" At ARGS: date [Product] [nutrition]. [Id "950107"] [msg "URL Encoding Abuse Attack Attempt"] [severity "WARNING"] [hostname "serramar.coop.br"] [uri "/ admin / products / edit / 7"] [unique_id "R3HZ1rrtAAIAAKH1tKEAAABr" ]

Я видел, что он отказывал в доступе к таблице продуктов питания, код:

[Продукт] [питание] http://i.stack.imgur.com/yg7q3.png

Я удалил эту таблицу, попытался снова зарегистрировать продукт и выдал эту ошибку:

[Tue Mar 22 22:31:46 2016] [error] [client 200.100.30.37] PHP Fatal error: Class 'imagick' not found in /home/serramar.coop.br/public_html/app/Plugin/upload/Model/ Behavior / UploadBehavior.php on line 829, referer: http://serramar.coop.br/admin/products/edit/7

Затем я понял, что класс imagick — это стандартный класс на каждом хосте, поддерживающем PHP, и я подозревал, что хостинг моего клиента не поддерживает php.

Я снова загружаю весь проект на хостинг php, который у меня есть (hostgator), и все работает без ошибок.

ПРИЧИНА: Хостинг без поддержки php.
РЕШЕНИЕ: замена хостинга на один с поддержкой PHP.

1

Другие решения

Других решений пока нет …