代码之家  ›  专栏  ›  技术社区  ›  dierre

此.htaccess的正确userdir.conf

  •  3
  • dierre  · 技术社区  · 14 年前

    背后的故事。。。

    好吧,我在用我的上网本做实验…没有备份文件。是的,我是个白痴:D

    问题

    我有这个 .htaccess 我的userdir中的文件在我搞砸我的部分之前工作正常:

    Options +FollowSymLinks
    
    RewriteEngine On
    
    RewriteBase /~dierre/DierReLabS/
    
    RewriteRule ^(tutorials|me|not-found|add)$ $1/ [R=301,L]
    
    RewriteRule ^me/$ me.php [L]
    RewriteRule ^style/$ style.css [L]
    RewriteRule ^logo/$ logo2.png [L]
    RewriteRule ^add/$ add.php [L]
    RewriteRule ^tutorials/$ tutorials.php [L]
    RewriteRule ^tutorial/([a-zA-Z0-9\-]+)/$ tutorial.php?tut=$1 [L]
    RewriteRule ^not-found/$ 404.php [L]
    
    # This is a real directory...
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    # Or it's a real file...
    RewriteCond %{REQUEST_FILENAME} -d
    # And it's not not-found/...
    RewriteCond $0 !=not-found/
    # And it's not the root
    RewriteCond $0 !=""
    # And it's not any of the above due to an internal redirect...
    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    # So cause a 404 response (you could redirect to 404.php if you want)
    RewriteRule ^.*$ - [R=404,L]
    
    ErrorDocument 404 /~dierre/DierReLabS/not-found/
    

    在用户目录中 .htaccess接口 中的默认参数不能正常工作 userdir.conf . 我已经没有这种配置了。当前配置为:

    <IfModule mod_userdir.c>
            UserDir public_html
            UserDir disabled root
    
            <Directory /home/*/public_html>
                    AllowOverride FileInfo AuthConfig Limit Indexes
                    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
                    <Limit GET POST OPTIONS>
                            Order allow,deny
                            Allow from all
                    </Limit>
                    <LimitExcept GET POST OPTIONS>
                            Order deny,allow
                            Deny from all
                    </LimitExcept>
            </Directory>
    </IfModule>
    

    我真的记不起我做了什么。你能帮助我吗?

    1 回复  |  直到 14 年前
        1
  •  1
  •   dierre    14 年前

    感谢上帝遗弃了笔记本电脑!我今天开始使用我的Thinkpad,它是一个带有未更新版本的站点的配置。

    <IfModule mod_userdir.c>
            UserDir public_html
            UserDir disabled root
    
            <Directory /home/*/public_html>
                    #AllowOverride FileInfo AuthConfig Limit Indexes
                    AllowOverride All
                    #Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
                    Options Indexes FollowSymLinks
                    <Limit GET POST OPTIONS>
                            Order allow,deny
                            Allow from all
                    </Limit>
                    <LimitExcept GET POST OPTIONS>
                            Order deny,allow
                            Deny from all
                    </LimitExcept>
            </Directory>
    </IfModule>