Estou com problemas com mod_rewrite!

  • lucasjet
  • Avatar de lucasjet Autor do Tópico
  • Offline
  • JCB! Novato
  • JCB! Novato
Mais
14 anos 6 meses atrás #45714 por lucasjet
lucasjet created the topic: Estou com problemas com mod_rewrite!
Ola pessoal tudo bem?.
estou com um grande problema aqui
recebi a missão de ativar URLs Amigáveis (Search Engine Friendly)
e mod_rewrite do Apache

mais quando renomeio o htaccess.txt para .htaccess ele me retorna um erro
500 Internal Server Error
procurei em muitos foruns achei diversos artigos mais nenhum resolve o meu problema

muitos dizem que o erro é porque o httpd.conf esta comentado a linha
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

mais
o meu httpd.conf do apache esta vazio o apache2.conf não tem nenhum loadmodule
mais na pasta mods-available tem um arquivo chamado rewrite.load que la tem a linha
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

creio que o mod_rewrite esteja ok

alguém tem alguma idéia do que pode ser ?

Please Entrar ou Registrar to join the conversation.


Mais
14 anos 6 meses atrás #45720 por rldesign
rldesign replied the topic: Re: Estou com problemas com mod_rewrite!
Vamos as perguntas:
Vc esta usando algum componente de SEF? Ou somente habilitando as configurações padrão do Joomla?

Que So que vc está usando?
Que servidor vc esta usando, se for Windows (Wamp, Xamp)?

Se for linux, qual é a distribuição?
Me diga qual é o diretorio padrão do Apache? (no var ou no home?)
To achando que deu algum problema na sua instalação do Apache.
Todos os arquivos .conf ficam as configurações principais de cada aplicação no linux (dns,mysql e etc)
Possivelvemte vc precisará reinstalar o seu pacote do apache...
Ou vc pode procurar na internet no site do Apache pela conf do htttpd.conf e do loadmodule. Faça a substituição e tente novamente.

Teste no seu navegador se a página principal está mostrando.
Crie um arquivo phpinfo (procure no google) tambem e veja se esta executando.

Com o uso do Notepadd++ poderia printar ou colar o seu htaccess pra vermos o que esta acontecendo.



O htaccess padrão é esse abaixo:
## Can be commented out if causes errors, see notes above.
#Options +FollowSymLinks

#
# mod_rewrite in use

RewriteEngine On

########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root)

# RewriteBase /


########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section


Tente ai e qualquer dúvida estou a disposição

Rafael Santana
Web Designer | R&L Design - Desenvolvimento Gráfico e Sites

Please Entrar ou Registrar to join the conversation.

  • lucasjet
  • Avatar de lucasjet Autor do Tópico
  • Offline
  • JCB! Novato
  • JCB! Novato
Mais
14 anos 6 meses atrás #45723 por lucasjet
lucasjet replied the topic: Re: Estou com problemas com mod_rewrite!
Primeiramente obrigado por responder!

Vamos la as respostas então

Não uso nenhum componente SEF só as configurações padrão mesmo

o Servidor em uso é linux ubuntu 4.6

o diretório padrão do apache é /etc/apache2

e nenhuma pagina funciona inclusive o info.php só volta a funcionar quando o .htaccess é renomeado


segue abaixo meu htaccess.

##
# @version $Id: htaccess.txt 9317 2007-11-07 03:02:08Z jinx $
# @package Joomla
# @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##
php_value memory_limit 12M


#####################################################
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations. It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file. If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's. If they work,
# it has been set by your server administrator and you do not need it set here.
#
# Only use one of the two SEF sections that follow. Lines that can be uncommented
# (and thus used) have only one #. Lines with two #'s should not be uncommented
# In the section that you don't use, all lines should start with #
#
#####################################################

## Can be commented out if causes errors, see notes above.
# Options +FollowSymLinks

#
# mod_rewrite in use

RewriteEngine On


# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root)

# RewriteBase /


########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section


########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

Please Entrar ou Registrar to join the conversation.

Mais
14 anos 6 meses atrás #45730 por rldesign
rldesign replied the topic: Re: Estou com problemas com mod_rewrite!
Primeramente recomendo vc atualizar quando puder as ultimas versões, pelo menos para a versão 9.10. Muito coisa vc consegue resolver atraves de interface gráfica.

Te recomendo baixar gratuitamente o Guia Foca Linux - vai te ajudar bastante!!!!! Recomendo sempre que tiver dúvidas de Linux ir no site Viva o Linux - o melhor e maior forum brasileiro

php_value memory_limit
Use isso diretamente no php.ini ou crie um arquivo desse dentro da pasta de sua instalação. (mas pode tirar isso por enquanto)


Dê os seguintes comandos:
sudo apt get reinstall apache2 mysql php (para reinstalar os pacotes)

Instale o phpmyadmin

Faça uma nova instalação ou restaure o backp dessa atual.

E faça os testes novamente. Altere a extensão de txt pra .htaccess.
Primeiramente sem o SEF e depois com o SEF ativado.

Boa sorte!

Rafael Santana
Web Designer | R&L Design - Desenvolvimento Gráfico e Sites

Please Entrar ou Registrar to join the conversation.