Jump to content

Recommended Posts

Posted

Hi

Tenho andado a tentar meter o RewriteEngine a funcionar mas estou com problemas

aqui /etc/apache2/apache2.conf não encontro nada relativo a rewrite.

também tentei aqui

/etc/php5/apache2/php.ini

mas a mesma coisa

após uma pesquisa encontrei isto

a2enmod rewrite

mas diz que o módulo rewrite já está activo

de qualquer maneira mesmo depois de reiniciar não me permite usar o RewriteEngine On

Já agora esta é a minha syntax

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA, L]

"If It Ain't Broke, Break it and build something Cooler!" Unknown

Posted

se tens o módulo do apache ligado, então deveria funcionar

a única razão que vejo para não funcionar é teres o AllowOverride "desligado" na configuração do teu site, não deixando a execução do .htaccess

verifica no segundo ficheiro que disse acima (/etc/apache2/sites-available/default) pelo seguinte código:

<Directory /var/www/>
# ...
# deverá ter "none" e altera para "All"
 AllowOverride All
# ...
</Directory>
IRC : sim, é algo que ainda existe >> #p@p
Posted

Depois de usar estes comandos para reiniciar

sudo /etc/init.d/apache2 restart

sudo service apache2 restart (muito provavelmente este é o único necessario mas pronto)

tenho isto como erro

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@localhost 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.

Já estive a ver e parece que tenho de ir ao httpd.conf para meter o mod_rewrite, mas esse ficheiro no meu nem sequer existe

li algures que em vez de httpd.conf é apache2.conf mas mesmo assim lá dentro não encontro essa porra

"If It Ain't Broke, Break it and build something Cooler!" Unknown

Posted (edited)
[Tue Feb 12 10:47:48 2013] [error] [client 127.0.0.1] File does not exist: /var/www/mvc/cenas
[Tue Feb 12 11:00:48 2013] [notice] caught SIGTERM, shutting down
[Tue Feb 12 11:00:49 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.4.6-1ubuntu1.1 configured -- resuming normal operations
[Tue Feb 12 11:00:53 2013] [notice] caught SIGTERM, shutting down
[Tue Feb 12 11:00:54 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.4.6-1ubuntu1.1 configured -- resuming normal operations
[Tue Feb 12 11:00:57 2013] [alert] [client 127.0.0.1] /var/www/mvc/.htaccess: RewriteRule: bad flag delimiters
[Tue Feb 12 11:05:45 2013] [alert] [client 127.0.0.1] /var/www/mvc/.htaccess: RewriteRule: bad flag delimiters
[Tue Feb 12 11:06:12 2013] [alert] [client 127.0.0.1] /var/www/mvc/.htaccess: RewriteRule: bad flag delimiters

instalei apache e php usando este tutorial

https://www.digitalocean.com/community/articles/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu

e nesta parte do tutorial

apt-cache search php5-

instalei isto

sudo apt-get install php5 php5-curl php5-gd php5-ffmpeg php5-cgi php5-fpm php5-dev php5-geoip php5-xdebug php5-dbg

muito provavelemente instalei coisas a mais mas ok

EDIT: Se usar um link assim

http://localhost/mvc/index.php/anything

funciona, aparece 1 que é o que meti dentro do index.php

mas se meter assim

http://localhost/mvc/anything

já não funciona

EDIT1: HappyHippyHippo obrigado mas já está resolvido

O meu problema é que no AllowOverride eu estava mudar um de cada vez, mas sempre que mudava metia o anterior para None.

Alterando os dois primeiros resolvi o assunto.

Obrigado

Edited by sEnte

"If It Ain't Broke, Break it and build something Cooler!" Unknown

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.