15053971836 注册 / 登录

虚拟主机如何实现php伪静态设置

时间: 阅读:336
虚拟主机如何实现php伪静态设置

最佳回答

抹不掉的回忆

抹不掉的回忆

2023-01-15 20:53:56

你好,这个得根据你的网站程序和WEB服务器环境来设置伪静态的,比如你用LNMP环境,而用的PHP程序是DZ2.5那么你的伪静态就可以为:
rewrite
^([^.]*)/topic-(.+).html$
$1/portal.php?mod=topic&topic=$2last;
rewrite
^([^.]*)/article-([0-9]+)-([0-9]+).html$
$1/portal.php?mod=view&aid=$2&page=$3
last;
rewrite
^([^.]*)/forum-(w+)-([0-9]+).html$
$1/forum.php?mod=forumdisplay&fid=$2&page=$3
last;
rewrite
^([^.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html$
$1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3
last;
rewrite
^([^.]*)/group-([0-9]+)-([0-9]+).html$
$1/forum.php?mod=group&fid=$2&page=$3
last;
rewrite
^([^.]*)/space-(username|uid)-(.+).html$
$1/home.php?mod=space&$2=$3
last;
rewrite
^([^.]*)/blog-([0-9]+)-([0-9]+).html$
$1/home.php?mod=space&uid=$2&do=blog&id=$3
last;
rewrite
^([^.]*)/(fid|tid)-([0-9]+).html$
$1/index.php?action=$2&value=$3
last;
rewrite
^([^.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_-]+).html$
$1/plugin.php?id=$2:$3
last;
if
(!-e
$request_filename)
{
return
404;
}
有问题可以+Q+群222802357找群主吧。

最新回答共有2条回答

  • 游客
    回复
    2023-01-15 22:22:58

    第一步:验证服务器或虚拟主机是否支持伪静态:①虚拟主机:询问主机提供商,看是否只是伪静态;②本地服务器:Apache 配置文件 httpd.conf1、LoadModule rewrite_module modules/mod_rewrite.so 把这句的“#”注释掉。2、AllowOverride none 改为 AllowOverride all重启apache服务器。
    第二步:详细设置:①在根目录上上传名为 .htaccess 的文件,如果里面请在里面增加相应代码; 代码如下:RewriteEngine OnRewriteRule ^(.*)content-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/index.php?m=content&c=index&a=show&catid=$2&id=$3&page=$4RewriteRule ^(.*)show-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/index.php?m=content&c=index&a=show&catid=$2&id=$3&page=$4RewriteRule ^(.*)list-([0-9]+)-([0-9]+).html$ $1/index.php?m=content&c=index&a=0xun.netlists&catid=$2&page=$3
    第三步:进入PHPCMS后台设置:①位置:内容-->管理栏目-->生成HTML项目栏目页URL规则:list-1-2-1.html内容页URL规则:content-1-2-1.html第四步:批量更新URL:①位置:内容-->批量更新URL②更新缓存