Boa Noite
Estou outra vez com problemas com o mod_rewrite.
Instalei e configurei o Apache e mysql sem problemas
Estou aqui a tentar criar um site e tenho um ficheiro .htaccess com o seguinte código...
Código :
e na página index.php tenho isto
Código (PHP):
se meter o link deste tipo
http://127.0.0.1/AdSN/index.php?url=qualquercoisa
aparece "qualquercoisa" escrito na página como era suposto, mas se ao invés colocar isto
http://127.0.0.1/AdSN/qualquercoisa
O que simplesmente aparece é
Not Found
The requested URL /AdSN/qualquercoisa was not found on this server.
Ou seja o mod_rewrite não está ativo.
encontrei na net este tutorial http://www.jarrodoberto.com/articles/2011/11/enabling-mod-rewrite-on-ubuntu que foi o que usei há algum tempo atrás
Na parte referente a
Código :
O caminho existe apenas não existe um ficheiro com o nome default...
Este é o conteudo de /var/log/apache2/error.log
Já agora estas são as infos do meu server
EDIT: Resolvido.....
Encontrei o que procurava aqui...
/etc/apache2/apache2.conf
Estou outra vez com problemas com o mod_rewrite.
Instalei e configurei o Apache e mysql sem problemas
Estou aqui a tentar criar um site e tenho um ficheiro .htaccess com o seguinte código...
Código :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
e na página index.php tenho isto
Código (PHP):
<?php
/* Router */
if (isset($_GET['url'])) {
echo $_GET['url'];
}
?>
/* Router */
if (isset($_GET['url'])) {
echo $_GET['url'];
}
?>
se meter o link deste tipo
http://127.0.0.1/AdSN/index.php?url=qualquercoisa
aparece "qualquercoisa" escrito na página como era suposto, mas se ao invés colocar isto
http://127.0.0.1/AdSN/qualquercoisa
O que simplesmente aparece é
Not Found
The requested URL /AdSN/qualquercoisa was not found on this server.
Ou seja o mod_rewrite não está ativo.
encontrei na net este tutorial http://www.jarrodoberto.com/articles/2011/11/enabling-mod-rewrite-on-ubuntu que foi o que usei há algum tempo atrás
Na parte referente a
Código :
sudo gedit /etc/apache2/sites-available/default
este ficheiro não existe e ao correr essa linha de código ele vai criar o ficheiro (supostamente ja deveria existir....)O caminho existe apenas não existe um ficheiro com o nome default...
Este é o conteudo de /var/log/apache2/error.log
Citar
[Sun Apr 20 22:05:02.887128 2014] [mpm_event:notice] [pid 5754:tid 139773914204032] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal $
[Sun Apr 20 22:05:02.887224 2014] [core:notice] [pid 5754:tid 139773914204032] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:08:15.228183 2014] [mpm_event:notice] [pid 5754:tid 139773914204032] AH00491: caught SIGTERM, shutting down
[Sun Apr 20 22:08:16.333752 2014] [mpm_prefork:notice] [pid 11842] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Sun Apr 20 22:08:16.333840 2014] [core:notice] [pid 11842] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:08:17.673486 2014] [mpm_prefork:notice] [pid 11842] AH00169: caught SIGTERM, shutting down
[Sun Apr 20 22:08:18.805700 2014] [mpm_prefork:notice] [pid 11928] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:08:18.805768 2014] [core:notice] [pid 11928] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:13:16.143140 2014] [mpm_prefork:notice] [pid 11928] AH00169: caught SIGTERM, shutting down
[Sun Apr 20 22:13:17.257553 2014] [mpm_prefork:notice] [pid 12983] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:13:17.257612 2014] [core:notice] [pid 12983] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:14:30.073564 2014] [mpm_prefork:notice] [pid 12983] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally$
[Sun Apr 20 22:14:30.160806 2014] [mpm_prefork:notice] [pid 12983] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:14:30.160820 2014] [core:notice] [pid 12983] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:14:43.630822 2014] [mpm_prefork:notice] [pid 12983] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally$
[Sun Apr 20 22:14:43.692100 2014] [mpm_prefork:notice] [pid 12983] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:14:43.692113 2014] [core:notice] [pid 12983] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:14:43.853821 2014] [mpm_prefork:notice] [pid 12983] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally$
[Sun Apr 20 22:14:43.923162 2014] [mpm_prefork:notice] [pid 12983] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:14:43.923174 2014] [core:notice] [pid 12983] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:15:33.469702 2014] [mpm_prefork:notice] [pid 12983] AH00169: caught SIGTERM, shutting down
[Sun Apr 20 22:15:34.544811 2014] [mpm_prefork:notice] [pid 14361] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:15:34.544848 2014] [core:notice] [pid 14361] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:18:51.435765 2014] [:error] [pid 14375] [client 127.0.0.1:37631] script '/var/www/html/info.php' not found or unable to stat
[Sun Apr 20 22:26:37.395836 2014] [:error] [pid 14369] [client 127.0.0.1:37740] PHP Notice: Use of undefined constant index - assumed 'index' in$
[Sun Apr 20 22:26:38.334629 2014] [:error] [pid 14369] [client 127.0.0.1:37740] PHP Notice: Use of undefined constant index - assumed 'index' in$
[Sun Apr 20 22:39:48.963894 2014] [mpm_prefork:notice] [pid 14361] AH00169: caught SIGTERM, shutting down
[Sun Apr 20 22:39:50.081051 2014] [mpm_prefork:notice] [pid 15260] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:39:50.081093 2014] [core:notice] [pid 15260] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:49:36.504880 2014] [mpm_prefork:notice] [pid 15260] AH00169: caught SIGTERM, shutting down
[Sun Apr 20 22:49:37.632938 2014] [mpm_prefork:notice] [pid 15498] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:49:37.632970 2014] [core:notice] [pid 15498] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:05:02.887224 2014] [core:notice] [pid 5754:tid 139773914204032] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:08:15.228183 2014] [mpm_event:notice] [pid 5754:tid 139773914204032] AH00491: caught SIGTERM, shutting down
[Sun Apr 20 22:08:16.333752 2014] [mpm_prefork:notice] [pid 11842] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Sun Apr 20 22:08:16.333840 2014] [core:notice] [pid 11842] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:08:17.673486 2014] [mpm_prefork:notice] [pid 11842] AH00169: caught SIGTERM, shutting down
[Sun Apr 20 22:08:18.805700 2014] [mpm_prefork:notice] [pid 11928] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:08:18.805768 2014] [core:notice] [pid 11928] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:13:16.143140 2014] [mpm_prefork:notice] [pid 11928] AH00169: caught SIGTERM, shutting down
[Sun Apr 20 22:13:17.257553 2014] [mpm_prefork:notice] [pid 12983] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:13:17.257612 2014] [core:notice] [pid 12983] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:14:30.073564 2014] [mpm_prefork:notice] [pid 12983] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally$
[Sun Apr 20 22:14:30.160806 2014] [mpm_prefork:notice] [pid 12983] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:14:30.160820 2014] [core:notice] [pid 12983] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:14:43.630822 2014] [mpm_prefork:notice] [pid 12983] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally$
[Sun Apr 20 22:14:43.692100 2014] [mpm_prefork:notice] [pid 12983] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:14:43.692113 2014] [core:notice] [pid 12983] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:14:43.853821 2014] [mpm_prefork:notice] [pid 12983] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally$
[Sun Apr 20 22:14:43.923162 2014] [mpm_prefork:notice] [pid 12983] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:14:43.923174 2014] [core:notice] [pid 12983] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:15:33.469702 2014] [mpm_prefork:notice] [pid 12983] AH00169: caught SIGTERM, shutting down
[Sun Apr 20 22:15:34.544811 2014] [mpm_prefork:notice] [pid 14361] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:15:34.544848 2014] [core:notice] [pid 14361] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:18:51.435765 2014] [:error] [pid 14375] [client 127.0.0.1:37631] script '/var/www/html/info.php' not found or unable to stat
[Sun Apr 20 22:26:37.395836 2014] [:error] [pid 14369] [client 127.0.0.1:37740] PHP Notice: Use of undefined constant index - assumed 'index' in$
[Sun Apr 20 22:26:38.334629 2014] [:error] [pid 14369] [client 127.0.0.1:37740] PHP Notice: Use of undefined constant index - assumed 'index' in$
[Sun Apr 20 22:39:48.963894 2014] [mpm_prefork:notice] [pid 14361] AH00169: caught SIGTERM, shutting down
[Sun Apr 20 22:39:50.081051 2014] [mpm_prefork:notice] [pid 15260] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:39:50.081093 2014] [core:notice] [pid 15260] AH00094: Command line: '/usr/sbin/apache2'
[Sun Apr 20 22:49:36.504880 2014] [mpm_prefork:notice] [pid 15260] AH00169: caught SIGTERM, shutting down
[Sun Apr 20 22:49:37.632938 2014] [mpm_prefork:notice] [pid 15498] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4 configured -- resuming norma$
[Sun Apr 20 22:49:37.632970 2014] [core:notice] [pid 15498] AH00094: Command line: '/usr/sbin/apache2'
Já agora estas são as infos do meu server
- Apache/2.4.7 (Ubuntu)
- Database client version: libmysql - 5.5.35
EDIT: Resolvido.....
Encontrei o que procurava aqui...
/etc/apache2/apache2.conf