2014-09-06 130 views
0

你好我目前正试图设置从我的codeigniter安装从我的数据库拾取的动态子域,每当我尝试访问一个子域我得到一个403错误我意识到一些问题可能造成这个我却无法determin它是一个对不起,如果我问一个明显的问题,但保险业监督很新的这在CodeIgniter中设置动态子域名

这里是我的设置虚拟主机

 <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> 

这里是我的.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 

这是我看到的错误,当我试图访问一个子

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

信息将是我使用本指南 http://code.tutsplus.com/tutorials/basecamp-style-subdomains-with-codeigniter--net-16330

建立我的笨子网域 *也当我访问域正如我已经将其设置为回声子域

回答

0

我因为找到了解决该子域的vir “domain.mobi” “域”是呼应tual主机只需要指向与主域相同的目录,然后我可以使用该子域作为参数

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