Je sèche depuis un jour et demi sur une erreur 403 que je ne parviens pas à gérer, il s'agit d'un lien de mon site vers une page depuis la page d'index. Je travaille sur wamp avec une vhost. Mes fichiers de conf sont ceux-ci :
httpd-vhost.conf :
<VirtualHost *:80> ServerName localhost ServerAlias localhost DocumentRoot C:/wamp/www <Directory "C:/wamp/www/"> Options Indexes FollowSymLinks MultiViews AllowOverride all Require local </Directory> </VirtualHost>
<VirtualHost *:80> DocumentRoot "C:/wamp/www/best" ServerName best ServerAlias www.best <Directory "C:/wamp/www/best/"> Options Indexes FollowSymLinks MultiViews AllowOverride All Require local </Directory> </VirtualHost>
le phpadmin.conf : <Directory "c:/wamp/apps/phpmyadmin4.1.14/"> Options Indexes FollowSymLinks MultiViews AllowOverride all
Allow from all
<IfDefine APACHE24> Require local </IfDefine> <IfDefine !APACHE24> Order Deny,Allow Deny from all Allow from localhost ::1 127.0.0.1 </IfDefine> php_admin_value upload_max_filesize 128M php_admin_value post_max_size 128M php_admin_value max_execution_time 360 php_admin_value max_input_time 360 </Directory>
Voilà, je travaille avec codeigniter en php, l'index s'affiche bien et les pages sont généralement bien affichées mais dans ce cas-ci, problème.
Il faudrait donner le chemin complet de la page à afficher ainsi que le code du lien de la page appelante et le message d'erreur complet. (log apache).
Et puis voir un éventuel fichier .htaccess avec des directives rewrite ou de redirection.
Je n'ai pas de fichier htacces sur ce projet, mais le chemin est le suivant : application/views/register.html et le chemin complet est localhost/Best/application/views/register.php mais via une configuration, si je mets application/views/register, j'obtiens dans l'url (de l'erreur 403) : localhost/Best/application/views/register.php
Dites moi si c'est suffisant comme infos sinon j'ajoute ce que vous pouvez me demander.
Axel
PS : j'ai fait la vérification de l'existence du lien avec if file_exists() en php, j'obtiens true mais le lien href="$_SERVER['DOCUMENT_ROOT']."/Best/application/views/register.php" me renvoie la 403...
Ok, un grand merci, c'est toujours bon à savoir. Par contre, je viens de corriger, le chemin de base dans le fichier de configuration (j'ai remplacé le : localhost/Best/ par [best]) mais ça ne marche toujours pas...
Voilà le message d'erreur que j'ai :
Forbidden
You don't have permission to access /application/views/register.php on this server. Apache/2.4.9 (Win32) PHP/5.5.12 Server at best Port 80
et voici le log appache :
[Thu Jul 23 11:25:15.079769 2015] [mpm_winnt:notice] [pid 4984:tid 256] AH00422: Parent: Received shutdown signal -- Shutting down the server. [Thu Jul 23 11:29:34.583206 2015] [core:warn] [pid 6136:tid 252] AH00098: pid file C:/wamp/bin/apache/apache2.4.9/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run? [Thu Jul 23 11:29:34.626209 2015] [mpm_winnt:notice] [pid 6136:tid 252] AH00455: Apache/2.4.9 (Win32) PHP/5.5.12 configured -- resuming normal operations [Thu Jul 23 11:29:34.626209 2015] [mpm_winnt:notice] [pid 6136:tid 252] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13 [Thu Jul 23 11:29:34.626209 2015] [core:notice] [pid 6136:tid 252] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.9\\bin\\httpd.exe -d C:/wamp/bin/apache/apache2.4.9' [Thu Jul 23 11:29:34.627209 2015] [mpm_winnt:notice] [pid 6136:tid 252] AH00418: Parent: Created child process 4108 [Thu Jul 23 11:29:35.723271 2015] [mpm_winnt:notice] [pid 4108:tid 308] AH00354: Child: Starting 64 worker threads. [Thu Jul 23 11:46:36.975684 2015] [authz_core:error] [pid 4108:tid 844] [client ::1:49469] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.php, referer: [best] [Thu Jul 23 16:21:14.409139 2015] [core:error] [pid 4108:tid 824] (20024)The given path is misformatted or contained invalid characters: [client ::1:52201] AH00127: Cannot map GET /%3Cbr%20/%3E%3Cfont%20size=%271%27%3E%3Ctable%20class=%27xdebug-error%20xe-notice%27%20dir=%27ltr%27%20border=%271%27%20cellspacing=%270%27%20cellpadding=%271%27%3E%3Ctr%3E%3Cth%20align=%27left%27%20bgcolor=%27 HTTP/1.1 to file, referer: [eskort] [Thu Jul 23 16:22:15.486633 2015] [core:error] [pid 4108:tid 824] (20024)The given path is misformatted or contained invalid characters: [client ::1:52226] AH00127: Cannot map GET /%3Cbr%20/%3E%3Cfont%20size=%271%27%3E%3Ctable%20class=%27xdebug-error%20xe-notice%27%20dir=%27ltr%27%20border=%271%27%20cellspacing=%270%27%20cellpadding=%271%27%3E%3Ctr%3E%3Cth%20align=%27left%27%20bgcolor=%27 HTTP/1.1 to file, referer: [eskort] [Thu Jul 23 16:37:32.732096 2015] [core:error] [pid 4108:tid 788] (20024)The given path is misformatted or contained invalid characters: [client ::1:52392] AH00127: Cannot map GET /%3Cbr%20/%3E%3Cfont%20size=%271%27%3E%3Ctable%20class=%27xdebug-error%20xe-notice%27%20dir=%27ltr%27%20border=%271%27%20cellspacing=%270%27%20cellpadding=%271%27%3E%3Ctr%3E%3Cth%20align=%27left%27%20bgcolor=%27 HTTP/1.1 to file, referer: [eskort] [Thu Jul 23 16:41:13.401718 2015] [core:error] [pid 4108:tid 848] (20024)The given path is misformatted or contained invalid characters: [client ::1:52454] AH00127: Cannot map GET /%3Cbr%20/%3E%3Cfont%20size=%271%27%3E%3Ctable%20class=%27xdebug-error%20xe-notice%27%20dir=%27ltr%27%20border=%271%27%20cellspacing=%270%27%20cellpadding=%271%27%3E%3Ctr%3E%3Cth%20align=%27left%27%20bgcolor=%27 HTTP/1.1 to file, referer: [eskort] [Thu Jul 23 16:42:21.766628 2015] [core:error] [pid 4108:tid 848] (20024)The given path is misformatted or contained invalid characters: [client ::1:52469] AH00127: Cannot map GET /%3Cbr%20/%3E%3Cfont%20size=%271%27%3E%3Ctable%20class=%27xdebug-error%20xe-notice%27%20dir=%27ltr%27%20border=%271%27%20cellspacing=%270%27%20cellpadding=%271%27%3E%3Ctr%3E%3Cth%20align=%27left%27%20bgcolor=%27 HTTP/1.1 to file, referer: [eskort] [Thu Jul 23 16:42:38.595590 2015] [core:error] [pid 4108:tid 824] (20024)The given path is misformatted or contained invalid characters: [client ::1:52473] AH00127: Cannot map GET /%3Cbr%20/%3E%3Cfont%20size=%271%27%3E%3Ctable%20class=%27xdebug-error%20xe-notice%27%20dir=%27ltr%27%20border=%271%27%20cellspacing=%270%27%20cellpadding=%271%27%3E%3Ctr%3E%3Cth%20align=%27left%27%20bgcolor=%27 HTTP/1.1 to file, referer: [eskort] [Mon Jul 27 12:10:33.025652 2015] [authz_core:error] [pid 4108:tid 828] [client ::1:57765] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.php, referer: [localhost] [Mon Jul 27 12:21:58.516860 2015] [mpm_winnt:notice] [pid 6136:tid 252] AH00422: Parent: Received shutdown signal -- Shutting down the server. [Mon Jul 27 12:22:00.633981 2015] [mpm_winnt:notice] [pid 4108:tid 308] AH00364: Child: All worker threads have exited. [Mon Jul 27 12:22:10.381539 2015] [mpm_winnt:notice] [pid 6136:tid 252] AH00430: Parent: Child process 4108 exited successfully. [Mon Jul 27 12:22:34.013891 2015] [mpm_winnt:notice] [pid 5888:tid 380] AH00455: Apache/2.4.9 (Win32) PHP/5.5.12 configured -- resuming normal operations [Mon Jul 27 12:22:34.013891 2015] [mpm_winnt:notice] [pid 5888:tid 380] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13 [Mon Jul 27 12:22:34.013891 2015] [core:notice] [pid 5888:tid 380] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.9\\bin\\httpd.exe -d C:/wamp/bin/apache/apache2.4.9' [Mon Jul 27 12:22:34.025891 2015] [mpm_winnt:notice] [pid 5888:tid 380] AH00418: Parent: Created child process 3256 [Mon Jul 27 12:22:35.605982 2015] [mpm_winnt:notice] [pid 3256:tid 296] AH00354: Child: Starting 64 worker threads. [Mon Jul 27 13:08:39.041418 2015] [authz_core:error] [pid 3256:tid 844] [client ::1:57947] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.php, referer: [localhost] [Mon Jul 27 13:22:03.215414 2015] [authz_core:error] [pid 3256:tid 844] [client ::1:57995] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.php, referer: [localhost] [Mon Jul 27 13:24:34.174049 2015] [authz_core:error] [pid 3256:tid 832] [client ::1:58044] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.php [Mon Jul 27 13:24:42.612531 2015] [authz_core:error] [pid 3256:tid 832] [client ::1:58045] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.php [Mon Jul 27 13:26:35.263975 2015] [authz_core:error] [pid 3256:tid 848] [client ::1:58061] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.php [Mon Jul 27 13:26:45.276547 2015] [authz_core:error] [pid 3256:tid 848] [client ::1:58062] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.php, referer: [localhost] [Mon Jul 27 18:08:53.168767 2015] [authz_core:error] [pid 3256:tid 828] [client ::1:58821] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.html, referer: [localhost] [Mon Jul 27 18:09:18.234201 2015] [authz_core:error] [pid 3256:tid 828] [client ::1:58828] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.html, referer: [localhost] [Mon Jul 27 18:10:59.047967 2015] [authz_core:error] [pid 3256:tid 836] [client ::1:58886] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.html, referer: [best] [Mon Jul 27 18:18:55.434215 2015] [authz_core:error] [pid 3256:tid 836] [client ::1:59130] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.html [Mon Jul 27 18:19:00.131484 2015] [mpm_winnt:notice] [pid 5888:tid 380] AH00422: Parent: Received shutdown signal -- Shutting down the server. [Mon Jul 27 18:19:02.135598 2015] [mpm_winnt:notice] [pid 3256:tid 296] AH00364: Child: All worker threads have exited. [Mon Jul 27 18:19:03.271663 2015] [mpm_winnt:notice] [pid 5888:tid 380] AH00430: Parent: Child process 3256 exited successfully. [Mon Jul 27 18:19:06.155828 2015] [mpm_winnt:notice] [pid 1476:tid 372] AH00455: Apache/2.4.9 (Win32) PHP/5.5.12 configured -- resuming normal operations [Mon Jul 27 18:19:06.155828 2015] [mpm_winnt:notice] [pid 1476:tid 372] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13 [Mon Jul 27 18:19:06.155828 2015] [core:notice] [pid 1476:tid 372] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.9\\bin\\httpd.exe -d C:/wamp/bin/apache/apache2.4.9' [Mon Jul 27 18:19:06.157828 2015] [mpm_winnt:notice] [pid 1476:tid 372] AH00418: Parent: Created child process 2020 [Mon Jul 27 18:19:07.012877 2015] [mpm_winnt:notice] [pid 2020:tid 296] AH00354: Child: Starting 64 worker threads. [Mon Jul 27 18:21:22.232611 2015] [authz_core:error] [pid 2020:tid 836] [client ::1:59215] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.html, referer: [localhost] [Mon Jul 27 18:22:21.355993 2015] [mpm_winnt:notice] [pid 1476:tid 372] AH00422: Parent: Received shutdown signal -- Shutting down the server. [Mon Jul 27 18:22:23.360108 2015] [mpm_winnt:notice] [pid 2020:tid 296] AH00364: Child: All worker threads have exited. [Mon Jul 27 18:22:23.393110 2015] [mpm_winnt:notice] [pid 1476:tid 372] AH00430: Parent: Child process 2020 exited successfully. [Mon Jul 27 18:22:25.905253 2015] [mpm_winnt:notice] [pid 7456:tid 372] AH00455: Apache/2.4.9 (Win32) PHP/5.5.12 configured -- resuming normal operations [Mon Jul 27 18:22:25.906253 2015] [mpm_winnt:notice] [pid 7456:tid 372] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13 [Mon Jul 27 18:22:25.906253 2015] [core:notice] [pid 7456:tid 372] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.9\\bin\\httpd.exe -d C:/wamp/bin/apache/apache2.4.9' [Mon Jul 27 18:22:25.910254 2015] [mpm_winnt:notice] [pid 7456:tid 372] AH00418: Parent: Created child process 5012 [Mon Jul 27 18:22:26.769303 2015] [mpm_winnt:notice] [pid 5012:tid 296] AH00354: Child: Starting 64 worker threads. [Mon Jul 27 18:23:12.381912 2015] [authz_core:error] [pid 5012:tid 836] [client ::1:59245] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.html, referer: [localhost] [Mon Jul 27 18:23:21.802451 2015] [authz_core:error] [pid 5012:tid 836] [client ::1:59260] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.html, referer: [localhost] [Mon Jul 27 18:23:36.936316 2015] [mpm_winnt:notice] [pid 7456:tid 372] AH00422: Parent: Received shutdown signal -- Shutting down the server. [Mon Jul 27 18:23:38.942431 2015] [mpm_winnt:notice] [pid 5012:tid 296] AH00364: Child: All worker threads have exited. [Mon Jul 27 18:23:38.976433 2015] [mpm_winnt:notice] [pid 7456:tid 372] AH00430: Parent: Child process 5012 exited successfully. [Mon Jul 27 18:23:40.794537 2015] [mpm_winnt:notice] [pid 1140:tid 372] AH00455: Apache/2.4.9 (Win32) PHP/5.5.12 configured -- resuming normal operations [Mon Jul 27 18:23:40.795537 2015] [mpm_winnt:notice] [pid 1140:tid 372] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13 [Mon Jul 27 18:23:40.795537 2015] [core:notice] [pid 1140:tid 372] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.9\\bin\\httpd.exe -d C:/wamp/bin/apache/apache2.4.9' [Mon Jul 27 18:23:40.796537 2015] [mpm_winnt:notice] [pid 1140:tid 372] AH00418: Parent: Created child process 4184 [Mon Jul 27 18:23:41.721590 2015] [mpm_winnt:notice] [pid 4184:tid 296] AH00354: Child: Starting 64 worker threads. [Mon Jul 27 18:26:44.409039 2015] [authz_core:error] [pid 4184:tid 832] [client ::1:59285] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.html, referer: [localhost] [Mon Jul 27 18:27:16.975902 2015] [authz_core:error] [pid 4184:tid 832] [client ::1:59292] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.html, referer: [localhost] [Tue Jul 28 10:51:40.012871 2015] [authz_core:error] [pid 4184:tid 808] [client ::1:60110] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.php, referer: [best] [Tue Jul 28 10:54:23.629229 2015] [authz_core:error] [pid 4184:tid 808] [client ::1:60162] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.php, referer: [best]
Prenons déjà la première erreur : >[Thu Jul 23 11:46:36.975684 2015] [authz_core:error] [pid 4108:tid 844] [client ::1:49469] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.php, referer: [best] Le referer "[best]; est invalide. Ce qui peut être traduit par "[best] # n'est pas un nom valide de variable get.
Ensuite : > [Mon Jul 27 18:21:22.232611 2015] [authz_core:error] [pid 2020:tid 836] [client ::1:59215] AH01630: client denied by server configuration: C:/wamp/www/best/application/views/register.html, referer:[localhost] Localhost dans le referer.
Votre second message disait : > Je n'ai pas de fichier htacces sur ce projet, ... Votre message ci-dessus : > J'ai repris le htacces, j'ai effacé les quelques lignes et ça tourne.
J'avoue que là, je suis un peu perdu !
Pour les fichiers .htaccess, il ne faut surtout pas oublier :
- 1 - Les fichiers .htaccess ne doivent être utilisés que si vous n'avez pas accès au fichier de configuration du serveur principal. L'utilisation des fichiers .htaccess ralentit le fonctionnement de votre serveur HTTP Apache. Il est toujours préférable de définir les directives que vous pouvez inclure dans un fichier .htaccess dans une section Directory du VirtulaHost, car elles produiront le même effet avec de meilleures performances.
- 2 - Notez aussi que httpd doit rechercher les fichiers .htaccess dans tous les répertoires de niveau supérieur, afin de rassembler toutes les directives qui s'appliquent au répertoire courant. Ainsi, si un fichier fait l'objet d'une requête à partir d'un répertoire /www/htdocs/exemple, httpd doit rechercher les fichiers suivants :
En conséquence, chaque accès à un fichier de ce répertoire nécessite 4 accès au système de fichiers supplémentaires pour rechercher des fichiers .htaccess, même si aucun de ces fichiers n'est présent. Notez que cet exemple ne peut se produire que si les fichiers .htaccess ont été autorisés pour le répertoire /, ce qui est rarement le cas.
- 3 - La fausse idée selon laquelle l'authentification de l'utilisateur devrait toujours être faite dans les fichiers .htaccess est très répandue. Il est aussi souvent avancé, ces dernières années, que les directives de mod_rewrite doivent être définies dans les fichiers .htaccess. Ceci est tout simplement faux. Vous pouvez configurer l'authentification des utilisateurs au niveau de la configuration du serveur principal, et c'est en fait cette méthode qui doit être privilégiée. De même, les directives de mod_rewrite fonctionneront mieux, à de nombreux égards, dans le contexte du serveur principal.
Un grand merci pour votre aide très instructive. En effet, je n'avais pas vu le fichier htaccess qui se trouvait dans un de mes dossiers. Je travaille avec code igniter et beaucoup de fichiers sont générés automatiquement.
Par contre, ce que je ne comprends pas bien, c'est en quoi mon fichier htaccess peut me générer une erreur 403. Je vais me renseigner sur les différents modules de configuration apache et serveur en général, ça devient indispensable ;-).
>... ce que je ne comprends pas bien, c'est en quoi mon fichier htaccess peut me générer une erreur 403. Tout simplement une ou plusieurs directives "rewrite" dans le fichier .htaccess alors que le module afférent d'Apache (rewrite_module) n'est pas chargé.