环境:win apache 放了.htaccess ,设置了httpd.cofig等,伪静态就是不成功.首页的伪静态链接已经生成,点进去都是"not found" 404(也就是说程序不能解析伪静态化后的url,.htaccess里的伪静态规则没有生效) 用phpinfo()函数查看了,重写模块已加载.有在win环境下配置好伪静态测试环境的同志帮忙提示一下,100分相赠
调试欢乐多
你的.htaccess是怎么写的?然后大家才好帮助你。
想不到大家都怀疑.htaccess里有问题.这个是没有问题的呀,在我的服务器里正常运行.只是说在本机不行,主要是设置问题我想下面还是帖上吧:RewriteEngine OnRewriteRule ^(.*)/(list|bencandy)-([^\.]+)\.([a-zA-Z0-9]+)$ $1/$2\.php\?stringID=$3
RewriteRule ^(.*)/([A-Z])([^\/]+)/([^\/]+)/f([^\/]+)\.([a-zA-Z0-9]+)$ $1/$2$3/bencandy\.php\?Fid=$4&Id=$5
RewriteRule ^(.*)/([A-Z])([^\/]+)/([^\/]+)/([^\/]+)/$ $1/$2$3/list\.php\?Fid=$5&zone_street=$4
RewriteRule ^(.*)/([A-Z])([^\/]+)/([^\/]+)/$ $1/$2$3/list\.php\?Fid=$4
RewriteRule ^(.*)/post.htm$ $1/post\.php
RewriteRule ^(.*)/post-([0-9]+)-([0-9]+)\.htm$ $1/post\.php\?fid=$2&city_id=$3
RewriteRule ^(.*)/post-edit-([0-9]+)-([0-9]+)\.htm$ $1/post\.php\?job=edit&fid=$2&id=$3
RewriteRule ^(.*)/post-del-([0-9]+)-([0-9]+)\.htm$ $1/post\.php\?action=del&fid=$2&id=$3
规则先写好,代码替换URL为规则里的格式
RewriteEngine On
#RewriteBase /
# direct one-word access
RewriteRule ^index\.html$ index\.php [L]
RewriteRule ^tg([0-9]+)p([0-9]+)\.html$ column\.php?cid=$1&page=$2 [QSA,L]
代码就要写
$html = str_replace('index.php', 'index.html', $html);
$html = preg_replace("/\"column.php\?cid=(\d+)&id=(\d+)&page=(\d+)/i", "\"tg$1id$2p$3.html", $html);