-
Mod_rewrite
Buon giorno
avrei bisogno di un consiglio.
Ho messo i file di elgg con l'ftp nello spazio, ma mi esce questo errore
The rewrite test failed and the most likely cause is that AllowOverride is not set to All for Elgg's directory. This prevents Apache from processing the .htaccess file which contains the rewrite rules.
Ritengo che ci sia bisogno di attivare mod_rewrite o qualcosa di simile.
Come posso fare?
-
Mod_rewrite è attivato, ma a quanto pare Elgg non riesce a riconoscerlo. Non so come faccia il test, ma assicurati che l'eventuale file .htaccess nella home contenga
-
La parte incriminata è
Io ho il sito nella cartella /social
Ho scrittoo
RewriteBase /social
Sono quasi obbligato a metterlo in una cartella interna perchè l'installazione lo richiede.
Codice:
<IfModule mod_rewrite.c>
RewriteEngine on
# If Elgg is in a subdirectory on your site, you might need to add a RewriteBase line
# containing the path from your site root to elgg's root. e.g. If your site is
# http://example.com/ and Elgg is in http://example.com/sites/elgg/, you might need
#
#RewriteBase /sites/elgg/
#
# here, only without the # in front.
#
# If you're not running Elgg in a subdirectory on your site, but still getting lots
# of 404 errors beyond the front page, you could instead try:
#
RewriteBase /social
# In for backwards compatibility
RewriteRule ^pg\/([A-Za-z0-9\_\-]+)$ engine/handlers/page_handler.php?handler=$1&%{QUERY_STRING}
RewriteRule ^pg\/([A-Za-z0-9\_\-]+)\/(.*)$ engine/handlers/page_handler.php?handler=$1&page=$2&%{QUERY_STRING}
RewriteRule ^tag\/(.+)\/?$ engine/handlers/page_handler.php?handler=search&page=$1
RewriteRule ^action\/([A-Za-z0-9\_\-\/]+)$ engine/handlers/action_handler.php?action=$1&%{QUERY_STRING}
RewriteRule ^cache\/(.*)$ engine/handlers/cache_handler.php?request=$1&%{QUERY_STRING}
RewriteRule ^services\/api\/([A-Za-z0-9\_\-]+)\/(.*)$ engine/handlers/service_handler.php?handler=$1&request=$2&%{QUERY_STRING}
RewriteRule ^export\/([A-Za-z]+)\/([0-9]+)\/?$ engine/handlers/export_handler.php?view=$1&guid=$2
RewriteRule ^export\/([A-Za-z]+)\/([0-9]+)\/([A-Za-z]+)\/([A-Za-z0-9\_]+)\/$ engine/handlers/export_handler.php?view=$1&guid=$2&type=$3&idname=$4
RewriteRule xml-rpc.php engine/handlers/xml-rpc_handler.php
RewriteRule mt/mt-xmlrpc.cgi engine/handlers/xml-rpc_handler.php
# rule for rewrite module test during install - can be removed after installation
RewriteRule ^rewrite.php$ install.php
# Everything else that isn't a file gets routed through the page handler
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Za-z0-9\_\-]+)$ engine/handlers/page_handler.php?handler=$1 [QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Za-z0-9\_\-]+)\/(.*)$ engine/handlers/page_handler.php?handler=$1&page=$2 [QSA]
</IfModule>
-
Uhm, l'installazione non è in una cartella interna, ma nella root del tuo sito al momento, quindi la RewriteBase sopra è sbagliata. Sposta tutto, oppure cambia la riga.
-
Si perchè l'ho spostata per vedere se poteva funzionare. Ma non funziona. Risposto ma il problema purtroppo rimarra :((((
-
Ho rimesso come prima :crycry:
Purtroppo non funzia... Ma il file dovrebbe essere giusto, d'altronde seguo le istruzioni.
-
Hai spostato tutto ma non il file .htaccess, direi.
-
ma il file .htacces l'ho messo nella cartella /social
E' giusto?
-
-
Nella doc c'è scritto che comunque questo lavoro è raramente richiesto.
Ma AllowOverride all è settato in httpd.conf?
perchè io in locale ho dovuto farlo
-
Non credo che AllowOverride sia settato su All per motivi di sicurezza, ma mod_rewrite funziona di solito senza problemi —c'è pieno di siti basati su di esso, incluso il mio.
Il problema è capire di cosa questo test automatico abbia bisogno, e farlo contento. La classe ElggRewriteTest nell'installazione sembra creare un nuovo htaccess a partire dal htaccess_dist, quindi devi modificare quel fille.
Altrimenti prendi il controllo e ci metti un bel return true :mrgreen: