douluo2930 2014-09-06 09:36
浏览 16
已采纳

too long

Hello I am currently trying to set up dynamic subdomains picked up from my database on my codeigniter installation whenever i try to access a subdomain i get a 403 error I realize a couple of issues might be causing this I however cannot determin which one it is I am sorry if I am asking an obvious question but i a quite new to this

here is my virtual host set up

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

Here is my .htaccess file

<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

This is the error i see when i try and access a subdomain

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

Additional information would be that i am using this guide http://code.tutsplus.com/tutorials/basecamp-style-subdomains-with-codeigniter--net-16330

to set up my codeigniter for the subdomains *also when i access the domain "domain.mobi" 'domain' is echoed as i have set it to echo the subdomain

  • 写回答

1条回答 默认 最新

  • dongqing4774 2014-09-07 22:28
    关注

    I since found a solution the subdomain virtual host just needs to be pointed to the same directory as the main domain and then I can use the subdomain as a parameter

    <VirtualHost *:80>
            **DocumentRoot /var/www**
            ServerName example.mobi
            ServerAlias *.example.mobi
            <Directory /var/www/subs/>
                    # Options +Indexes
                    Options FollowSymLinks
                    AllowOverride All
            </Directory>
    </VirtualHost>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?