2014-09-06 3 views
0

Bonjour Je suis actuellement en train d'essayer de configurer des sous-domaines dynamiques récupérés depuis ma base de données sur mon installation de codeigniter chaque fois que j'essaie d'accéder à un sous-domaine. cela, je ne peux cependant pas détermi que l'on est que je suis désolé si je pose une question évidente mais iA tout à fait nouveau à ceConfiguration de sous-domaines dynamiques dans CodeIgniter

ici est mon hôte virtuel mis en place

 <VirtualHost *:80> 
     DocumentRoot /var/www 
     ServerName www.example.mobi 
     ServerAlias example.mobi 
     <Directory /> 
       Options FollowSymLinks 
       AllowOverride All 
     </Directory> 
     <Directory /var/www/> 
       Options Indexes FollowSymLinks MultiViews 
       AllowOverride All 
       Order allow,deny 
       allow from all 
     </Directory> 
     ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ 
     <Directory "/usr/lib/cgi-bin"> 
       AllowOverride None 
       Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch 
       Order allow,deny 
       Allow from all 
     </Directory> 
     ErrorLog ${APACHE_LOG_DIR}/error.log 
     # Possible values include: debug, info, notice, warn, error, crit, 
     # alert, emerg. 
     LogLevel warn 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 
    Alias /doc/ "/usr/share/doc/" 
    <Directory "/usr/share/doc/"> 
     Options Indexes MultiViews FollowSymLinks 
     AllowOverride None 
     Order deny,allow 
     Deny from all 
     Allow from 127.0.0.0/255.0.0.0 ::1/128 
    </Directory> 
</VirtualHost> 

<VirtualHost *:80> 
     DocumentRoot /var/www/subs 
     ServerName example.mobi 
     ServerAlias *.example.mobi 
     <Directory /var/www/subs/> 
       # Options +Indexes 
       Options FollowSymLinks 
       AllowOverride All 
     </Directory> 
</VirtualHost> 

Voici mon fichier .htaccess

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/
    #this is to allow no indexes 
    Options All +Indexes 

    #Removes access to the system folder by users. 
    #Additionally this will allow you to create a System.php controller, 
    #previously this would not have been possible. 
    #'system' can be replaced if you have renamed your system folder. 
    RewriteCond %{REQUEST_URI} ^system.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    #When your application folder isn't in the system folder 
    #This snippet prevents user access to the application folder 
    #Submitted by: Fabdrol 
    #Rename 'application' to your applications folder name. 
    RewriteCond %{REQUEST_URI} ^application.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    #Checks to see if the user is attempting to access a valid file, 
    #such as an image or css document, if this isn't true it sends the 
    #request to index.php 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 

<IfModule !mod_rewrite.c> 
    # If we don't have mod_rewrite installed, all 404's 
    # can be sent to index.php, and everything works as normal. 
    # Submitted by: ElliotHaughin 

    ErrorDocument 404 /index.php 
</IfModule> 
AddType image/x-windows-bmp bmp 

C'est l'erreur que je vois quand je tente accéder à un sous-domaine

[error] [client x.x.s.x] Directory index forbidden by Options directive: /var/www/subs/ 

Informations complémentaires serait que j'utilise ce guide http://code.tutsplus.com/tutorials/basecamp-style-subdomains-with-codeigniter--net-16330

de mettre en place mon CodeIgniter pour les sous-domaines * aussi quand j'accède au domaine "domain.mobi" 'domaine' est renvoyé comme je l'ai mis à l'écho le sous-domaine

Répondre

0

J'ai depuis trouvé une solution le sous-domaine vir hôte tual doit juste être pointé vers le même répertoire que le domaine principal, puis je peux utiliser le sous-domaine en tant que paramètre

<VirtualHost *:80> 
     **DocumentRoot /var/www** 
     ServerName example.mobi 
     ServerAlias *.example.mobi 
     <Directory /var/www/subs/> 
       # Options +Indexes 
       Options FollowSymLinks 
       AllowOverride All 
     </Directory> 
</VirtualHost> 
Questions connexes