PDA

View Full Version : .htaccess e sottocartella


St3rMiN4ToR
09-08-2008, 16:22
Ciao ragazzi,
ho creato un .htaccess per indirizzare il dominio su una cartella specifica da me creata nella cartella default "web" del server.

Ovvero, vorrei indirizzare il dominio in questa cartella:
/web/cartellacreata

Ecco il codice che ho scritto in .htaccess:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/cartellacreata/
RewriteRule (.*) http://www.miodominio.ch/cartellacreata/$1 [R=301]

Ora digitando http://www.miodominio.ch appare anche il nome della cartella, ovvero http://www.miodominio.ch/cartellacreata

Come faccio a nasconde dall'indirizzo "cartellacreata" in modo che appaia solamente http://www.miodominio.ch?

Grazie dell'aiuto :)

M.

n0ise
09-08-2008, 17:01
prova aggiungendo

RewriteRule ^index\.html$ cartellacreata/index.html



naturalmente cambia l'estensione dell'index se non hai html, metti php, asp ecc ecc

St3rMiN4ToR
09-08-2008, 18:10
Ho trovato questo e funziona alla grande

# Bluehost.com
# .htaccess main domain to subfolder redirect
# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.


# Do not change this line.

RewriteEngine on


# Change yourdomain.com to be your main domain.

RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$


# Change 'subfolder' to be the folder you will use for your main domain.

RewriteCond %{REQUEST_URI} !^/subfolder/

# Don't change this line.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Change 'subfolder' to be the folder you will use for your main domain.

RewriteRule ^(.*)$ /subfolder/$1

# Change yourdomain.com to be your main domain again.
# Change 'subfolder' to be the folder you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.

RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
RewriteRule ^(/)?$ subfolder/index.php [L]

Ok, fin qui ci siamo. La dns punta ora alla sottocartella senza nominare il nome della sottocartella nella DNS.

Ora come faccio per nascondere pure il nome della cartella anche nelle sottocartelle della sottocartella?

Quando clicco su "amministratore", apparte quanto segue:
http://www.miosito.ch/nomecartella/amministratore
Io vorrei: http://www.miosito.ch/amministratore

Ovvero eliminare "nomecartella"

Scusate le ripetizioni ^^