此 .htaccess 的正确 userdir.conf
背后的故事...
好吧,我正在用我的上网本进行实验...没有备份文件。是的,我是个白痴:D
问题
我的用户目录中有这个.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/
在用户目录中这个< code>.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>
我真的不记得我做了什么。你能帮助我吗?
The story behind...
Ok, I was experimenting things with my netbook...without having backup files. Yes, I'm a moron :D
The Problem
I have this .htaccess
file in my userdir which was working properly before I screwed up my partion:
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/
In the userdir this .htaccess
does not work properly with the default parameters in userdir.conf
. I do not have anymore that configuration. The current configuration is:
<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>
I really can't recall what I did. Can you help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢上帝遗弃了笔记本电脑!我今天启动了我的 Thinkpad,它的配置与站点的非更新版本有关。
Thanks God for forsaken laptop! I've started today my Thinkpad and it was there the configuration with a non-updated version of the site.