pretty url [RISOLTO]

La discussione sul CMS Made Simple in italiano.

Moderator: magallo

Post Reply
doppioconfronto
Forum Members
Forum Members
Posts: 38
Joined: Wed Dec 12, 2007 7:45 am

pretty url [RISOLTO]

Post by doppioconfronto »

Vorrei implementare il sistema pretty url per il mio cms. Ho letto la guida in inglese, ma non sono troppo pratico. Ho capito che che fondamentalmente le opzioni sono 2, o con il rewrite di apache oppure modificando il template usato (se sbaglio mi correggerete). Se qualche anima pia potesse darmi qualche informazione in più, quello che vorrei ottenere io è il seguente risultato www.nomesito.com/seconda_pagina invece di www.nomesito.com/index.php=? e via dicendo. Un grazie anticipato ed un saluto.
Last edited by doppioconfronto on Tue May 18, 2010 4:37 pm, edited 1 time in total.
alby

Re: pretty url

Post by alby »

doppioconfronto wrote: ...oppure modificando il template usato ...
Non devi modificare assolutamente niente.
1. In doc c'è un file htaccess.txt copialo nella root della tua installazione e rinominalo a .htaccess
2. In config.php modifica da 'none' a 'mod_rewrite' il $config['url_rewriting']

Alby
doppioconfronto
Forum Members
Forum Members
Posts: 38
Joined: Wed Dec 12, 2007 7:45 am

Re: pretty url

Post by doppioconfronto »

Ho seguito alla lettera quello che mi hai scritto, ma il sito va off line e compare il solito messaggio "Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, postmaster@giochigommosi.it 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."
Ho provato anche a ripristinare le permission dal pannello di amminsitrazione di aruba, ma stesso risultato. Ora ovviamente ho risettato a none ed il sito è tornato visibile. Cosa potrebbe essere? 
nervino
Power Poster
Power Poster
Posts: 448
Joined: Sun Dec 28, 2008 12:15 pm

Re: pretty url

Post by nervino »

Ciao, mi è capitato di installare qualcosa su Aruba e, in effetti, alcune configurazioni di htaccess davano errore.

Ti posto l'htaccess che ho in archivio per Aruba. Prova...

Code: Select all

# Questa configurazione per il mod_rewrite engine funziona su ARUBA.
# Gli esempi di http://wiki.cmsmadesimple.org/index.php/FAQ/Installation/Pretty_URLs#Pretty_URL.27s
# su Aruba non funzionano
# In particolare, la direttiva "Options +FollowSymLinks" sembra non funzionare perché dà errore.
# Nella configurazione sottostante, prestare attenzione all'estensione del file (.html, .htm ecc.)
# che deve essere UGUALE a quella impostata nel config.php di CMSMS

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

# Deny access to config.php
# This can be useful if php ever breaks or dies
# Use with caution, this may break other functions of CMSms that use a config.php
# file.  This may also break other programs you have running under your CMSms
# install that use config.php.  You may need to add another .htaccess file to those
# directories to specifically allow config.php.

<Files "config.php">
    order allow,deny
    deny from all
</Files>
# URL Filtering helps stop some hack attempts
#IF the URI contains a "http:"
RewriteCond %{QUERY_STRING} http\: [OR]

#OR if the URI contains a "["
RewriteCond %{QUERY_STRING} \[ [OR]

#OR if the URI contains a "]"
RewriteCond %{QUERY_STRING} \] [OR]

#OR if the URI contains a "<__script__>"
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]

#OR if the script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]

#OR if any script is trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) [OR]

#OR if the URI contains UNION
RewriteCond %{QUERY_STRING} UNION [OR]

#OR if the URI contains a double slash
RewriteCond %{QUERY_STRING} // [OR]

#OR if the URI contains a *
RewriteCond %{QUERY_STRING} \*

#then deny the request (403)
RewriteRule ^.*$ - [F,L]

# End URL Filtering

# No sense advertising what we are running
ServerSignature Off
doppioconfronto
Forum Members
Forum Members
Posts: 38
Joined: Wed Dec 12, 2007 7:45 am

Re: pretty url

Post by doppioconfronto »

Grazie millle, ma c'è ancora qualcosa che non funziona. Ora modificando così il file htaccess la home viene caricata correttamente, poi però quando clicco su uno dei qualsiasi link interni del sito, mi compare nella barra degli indirizzi www.nomesito\nomepagina (senza alcuna estensione) e mi dice impossibile trovare la pagina web. 
nervino
Power Poster
Power Poster
Posts: 448
Joined: Sun Dec 28, 2008 12:15 pm

Re: pretty url

Post by nervino »

Hai specificato l'estensione nel file config.php?
Deve coincidere con quella impostata nell'htaccess - 4° direttiva dello script che ho postato (RewriteRule ^(.+).html$ index.php?page=$1 [QSA]).
Last edited by nervino on Tue May 18, 2010 1:13 pm, edited 1 time in total.
doppioconfronto
Forum Members
Forum Members
Posts: 38
Joined: Wed Dec 12, 2007 7:45 am

Re: pretty url

Post by doppioconfronto »

Mancava quello, risolto, grazie mille...
Post Reply

Return to “Italian - Italiano”