rewrite

讨论程序使用中的问题
回复
kesor
帖子: 109
注册时间: 2008年 2月 3日 19:53
联系:

rewrite

帖子 kesor »

生成的.htaccess 好像不能用
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

提示:
无法启用重写功能, 请检查你的服务器设置

而我的wordpress是可以的
头像
joyqi
帖子: 422
注册时间: 2007年 7月 24日 19:43
联系:

Re: rewrite

帖子 joyqi »

你直接将url中的index.php去掉访问,会得到什么页面?
wareunix
帖子: 21
注册时间: 2008年 12月 12日 19:38

Re: rewrite

帖子 wareunix »

呵呵
我是这样做的:
LoadModule rewrite_module modules/mod_rewrite.so
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
kesor
帖子: 109
注册时间: 2008年 2月 3日 19:53
联系:

Re: rewrite

帖子 kesor »

[quote="70"]你直接将url中的index.php去掉访问,会得到什么页面?[/quote]
404 Not Found
头像
joyqi
帖子: 422
注册时间: 2007年 7月 24日 19:43
联系:

Re: rewrite

帖子 joyqi »

这可能是你的rewrite模块没有启用的缘故,要不然起码也应该是一个500的页面,不会出现404
或者是楼上的wareunix说的
没有将设置此目录下的
AllowOverride All
wareunix
帖子: 21
注册时间: 2008年 12月 12日 19:38

Re: rewrite

帖子 wareunix »

修正下,要修改这里:
<Directory "D:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All #这里

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>
kesor
帖子: 109
注册时间: 2008年 2月 3日 19:53
联系:

Re: rewrite

帖子 kesor »

把wp的.htaccess抄了来

代码: 全选

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

区别只在rewrite规则最后一行
wordpress
[list]RewriteRule . /index.php [L][/list:u]
typecho
[list]RewriteRule ^(.*)$ /index.php/$1 [L][/list:u]
我把wp的.htaccess上传到typecho根目录,现在运行正常……
头像
joyqi
帖子: 422
注册时间: 2007年 7月 24日 19:43
联系:

Re: rewrite

帖子 joyqi »

这个特性将在0.6版得到支持,系统会先用typecho风格的.htaccess测试,然后使用wordpress风格的.htaccess测试
兼容性将更好
mayagamer
帖子: 18
注册时间: 2009年 4月 5日 07:52

Re: rewrite

帖子 mayagamer »

很人性化,充分考虑了WP迁移过来的人
kesor
帖子: 109
注册时间: 2008年 2月 3日 19:53
联系:

Re: rewrite

帖子 kesor »

没错,0.6做到了
回复