2010-10-20 12 views
1

Salut, j'ai installé plusieurs applications dans Kohana v3, il fonctionne normalement sans .htaccess permet (pour enlever index.php ou admin.php).htaccess pour une application multiple dans Kohana V3

ma configuration

 
+ system/ 
+ modules/ 
+ applications/ 
    + public/ 
    + bootstrap.php 
    + ... 
    + admin/ 
    + bootstrap.php 
    + ... 
+ index.php (for 'public' application) 
+ admin.php (for 'admin' application) 

afin d'accéder à l'exemple de l'interface utilisateur sera;

 
http://mydomain.com/index.php/(controller_name)/... 

et d'accéder au site d'administration;

 
http://mydomain.com/admin.php/(controller_name)/... 

La tâche est, je veux enlever et remplacer index.php (par défaut url) et admin.php avec/admin/en utilisant .htaccess (mod_rewrite) il peut donc être

 
http://mydomain.com/(controller_name)   <- 'public' application 
http://mydomain.com/admin/(controller_name)  <- 'admin' application 

ma current.htaccess (ne fonctionne pas) est;

 
# Turn on URL rewriting 
RewriteEngine On 

# Installation directory 
RewriteBase /ko3/ 

# Protect hidden files from being viewed 

    Order Deny,Allow 
    Deny From All 


# Protect application and system files from being viewed 
RewriteRule ^(?:web-apps|modules|core)\b.* index.php/$0 [L] 

# Allow any files or directories that exist to be displayed directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

# TODO: rewrite admin URL to admin.php/URL 
#RewriteRule ^admin/(.*) admin.php/$0 [L] 

# Rewrite all other URLs to index.php/URL 
RewriteRule .* index.php/$0 [PT] 

Répondre

0

Habituellement RewriteBase param est '/' au lieu de '/ KO3 /' - son nom de dossier dans votre Webroot. Vérifiez également la configuration du serveur Web pour le support de modrewrite.

+0

/ko3/est ma racine de document dans le serveur .. ignorez ceci. J'ai besoin d'aide sur RewriteCond/RewriteRule – khairil

+0

anciennes URL ('http://mydomain.com/admin.php/ (controller_name)/... ') fonctionnent toujours? – biakaveron

+0

oui c'est encore du travail. J'ai besoin de réécrire ce admin.php => admin et de rediriger tout le reste à index.php/ – khairil

0
# Catch every request for admin 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
# Rewrite all URLs to admin.php/URL 
RewriteRule ^admin/(.*) admin.php/$1 [PT,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
# Rewrite all other URLs to index.php/URL 
RewriteRule .* index.php/$0 [PT,L]