适合这个.htaccess的userdir.conf

时间:2010-11-27 00:17:37

标签: .htaccess apache2

背后的故事......

好的,我正在尝试使用我的上网本...没有备份文件。是的,我是个白痴:D

问题

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

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 个答案:

答案 0 :(得分:1)

感谢上帝为被遗忘的笔记本电脑!我今天开始使用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>