Per poter far funzionare .htaccess su altervista, dovete avere innanzitutto la risorsa abilitata, andare poi su gestione files e cliccare sulla icona della ghiera in alto.
Lì incollate il codice seguente.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]e salvate.
Vi consentirà di avere i clean url
Per poter utilizzare la funzione del clean url su TopHost il file standard .htaccess va sostituito con quello sotto:
<?php
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
Order allow,deny
# Don't show directory listings for URLs which map to a directory.
Options -Indexes
# Follow symbolic links in this directory.
Options +FollowSymLinks
# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php
# Force simple error message for requests for non-existent favicon.ico.
# There is no end quote below, for compatibility with Apache 1.3.
ErrorDocument 404 "The requested file favicon.ico was not found.
# Set the default handler.
DirectoryIndex index.php
# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.
# PHP 4, Apache 1.
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
# PHP 4, Apache 2.
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
# PHP 5, Apache 1 and 2.
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
Su Aruba il file .htaccess dà molti problemi alle varie versioni di Drupal, rendendo impossibile l'abilitazione del clean URL (admin > settings). Non si può quindi con il file incluso nell'installazione di Drupal, non avere "?q=" nell'URL.
Ovviamente bisogna fare attenzione anche alla riga che cambia in funzione della cartella di installazione di drupal
#Modify the RewriteBase if you are using Drupal in a subdirectory and
#the rewrite rules are not working properly.
RewriteBase /drupal Per maggiori informazioni guardare anche questo messaggio sul forum: http://www.drupalitalia.org/node/3619#comment-2854
Questo codice è da sostituire a quello dato da Drupal.org per farlo funzionare su Aruba. ( in grassetto sono le righe da commentare assolutamente)
#
# Apache/PHP/site settings:
#
# Protect files and directories from prying eyes:
order deny,allow
deny from all
# Set some options
# non supportato da aruba
#Options -Indexes
# non supportato da aruba
#Options +FollowSymLinks
# Customized server error messages:
ErrorDocument 404 /index.php
# Set the default handler to index.php:
# non supportato da aruba
#DirectoryIndex index.php
# Overload PHP variables:
# If you are using Apache 2, you have to use
# instead of .
php_value register_globals 0
php_value track_vars 1
php_value short_open_tag 1
php_value magic_quotes_gpc 0
php_value magic_quotes_runtime 0
php_value magic_quotes_sybase 0
php_value arg_separator.output "&"
php_value session.cache_expire 200000
php_value session.gc_maxlifetime 200000
Se hai abilitato il Clean Url e questo non dovesse funzionare l'accesso al tuo sito è impossibile e quindi è impossibile anche accedere alle pagine di configurazione per disabilitare il "clean url".
Le soluzioni sono due:
1 SQL Script da eseguire sul DB
UPDATE variable SET value = 's:1:"0";' WHERE name = 'clean_url';
DELETE FROM cache;
2 Aggiungere questa linea al file settings.php
$conf['clean_url'] = 0;