【发布时间】:2012-02-10 12:03:54
【问题描述】:
mod_rewrite 需要做哪些初始设置?
因为找不到合适的文章而问这个问题。
我认为这个问题会被否决。
好的,为了避免被否决,
我尝试了这些设置,但 mod_rewrite 似乎不起作用:
LoadModule rewrite_module modules/mod_rewrite.so
<Directory />
Options -Indexes +FollowSymLinks
RewriteEngine On
AllowOverride All
</Directory>
<Directory "/mysite">
Options -Indexes +FollowSymLinks
AllowOverride All # was suggested to do this from many sites.
# So mod_rewrite could work
Order allow,deny
Allow from all
RewriteEngine On
</Directory>
<VirtualHost 'ip-addr'>
.
.
.
Options -Indexes +FollowSymLinks
RewriteEngine On
</VirtualHost>
httpd -t -D DUMP_MODULES | grep rewrite
有输出:
rewrite_module (shared)
Syntax OK
我的DocumentRoot 是/mysite。
在/mysite/xhprof 中设置xhprof。
xhprof 的index 文件位于/mysite/xhprof/xhprof_html。
在/mysite/xhprof/xhprof_html/.htaccess 中有这个。
RewriteEngine On
RewriteBase /xhprof
当我尝试访问 <myurl>/xhprof/xhprof_html/ 时,url 不会被重写。
【问题讨论】:
-
I think this question will be down-voted.我认为这是一个准确的看法。 ;) 但是,您可以通过“设置”澄清您的意思来防止这种情况发生。你想达到什么目标? -
@pekka :) 添加了更多细节。
-
我没有看到您的 .htaccess 中定义的任何 RewriteRules。你期待什么重写?
-
@UlrichPalha 雅,确实知道.. 解决它的某个时候回来。这个问题现在是无声的。不过,感谢您的帮助。
标签: apache .htaccess mod-rewrite url-rewriting apache2