新浦京81707con > 首页 > 设置方法详解,APACHE实现网址伪静态

原标题:设置方法详解,APACHE实现网址伪静态

浏览次数:59 时间:2019-08-14

match URL into $ with ^(.*).(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ 
if matched then 
 set URL = /404.php
endif
match URL into $ with ^(.*)/file/(.*).php(.*)$ 
if matched then 
 set URL = /404.php
endif
match URL into $ with ^(.*)-htm-(.*)$ 
if matched then 
 set URL = $1.php?$2 
endif
match URL into $ with ^(.*)/show-([0-9] )([-])?([0-9] )?.html$ 
if matched then 
 set URL = $1/show.php?itemid=$2&page=$4 
endif
match URL into $ with ^(.*)/list-([0-9] )([-])?([0-9] )?.html$ 
if matched then 
 set URL = $1/list.php?catid=$2&page=$4 
endif
match URL into $ with ^(.*)/show/([0-9] )/([0-9] )?([/])?$ 
if matched then 
 set URL = $1/show.php?itemid=$2&page=$3 
endif
match URL into $ with ^(.*)/list/([0-9] )/([0-9] )?([/])?$ 
if matched then 
 set URL = $1/list.php?catid=$2&page=$3 
endif
match URL into $ with ^(.*)/([A-za-z0-9_-] )-c([0-9] )-([0-9] ).html$
if matched then 
 set URL = $1/list.php?catid=$3&page=$4
endif
match URL into $ with ^(.*)/([a-z] )/(.*).shtml$ 
if matched then 
 set URL = $1/$2/index.php?rewrite=$3 
endif
match URL into $ with ^(.*)/com/([a-z0-9_-] )/([a-z] )/(.*).html$ 
if matched then 
 set URL = $1/index.php?homepage=$2&file=$3&rewrite=$4 
endif
match URL into $ with ^(.*)/com/([a-z0-9_-] )/([a-z] )([/])?$ 
if matched then 
 set URL = $1/index.php?homepage=$2&file=$3 
endif
match URL into $ with ^(.*)/com/([a-z0-9_-] )([/])?$ 
if matched then 
 set URL = $1/index.php?homepage=$2 
endif

 代码如下

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "d:/wamp/www/dz"
ServerName localhost.www.dz.cn
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

Apache 1.x 的用户请检查 conf/httpd.conf 中是或不是留存如下两段代码:

复制代码

   2.让apache服务器帮助.htaccess    怎么样让本身的本土APACHE服务器帮忙:“htaccess”呢? 只需修改apache的httpd.conf设置就可以让 APACHE援助“.htaccess”了。展开APACHE目录的CONF目录下的httpd.conf文件,找到: Options FollowSymLinks AllowOverride None 改为 Options FollowSymLinks AllowOverride All 就行了。

假诺存在,且以#开头,请删除#。然后在安插文件(经常便是conf/httpd.conf只怕conf/extra/httpd-vhosts.conf)中投入如下代码。
此时请务必注意,如若网址接纳通过设想主机来定义,请务必加到虚构主机配置,即<VirtualHost>中去,固然加在虚构主机配置外界将恐怕不能使用。改好后然后将 Apache 重启。

<IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteRule ^(.*)/archiver/((fid|tid)-[w-] .html)$ $1/archiver/index.php?$2
      RewriteRule ^(.*)/forum-([0-9] )-([0-9] ).html$ $1/forumdisplay.php?fid=$2&page=$3
      RewriteRule ^(.*)/thread-([0-9] )-([0-9] )-([0-9] ).html$ $1/viewthread.php?tid=$2&extra=page=$4&page=$3
      RewriteRule ^(.*)/space-(username|uid)-(. ).html$ $1/space.php?$2=$3
      RewriteRule ^(.*)/tag-(. ).html$ $1/tag.php?name=$2
</IfModule>

 Apache的 mod_rewrite是相比强硬的,在进展网站建设时,能够经过那个模块来得以实现伪静态。

Apache 2.x 的用户请检查 conf/httpd.conf 中是不是存在如下一段代码:

 代码如下

127.0.0.1 localhost.www.dz.cn   重启服务就可以。              大功告成!

6、IIS7服务器

RewriteRule ^archiver/((fid|tid)-[w-] .html)$ archiver/index.php?$1
RewriteRule ^forum-([0-9] )-([0-9] ).html$ forumdisplay.php?fid=$1&page=$2
RewriteRule ^thread-([0-9] )-([0-9] )-([0-9] ).html$ viewthread.php?tid=$1&extra=page=$3&page=$2
RewriteRule ^space-(username|uid)-(. ).html$ space.php?$1=$2
RewriteRule ^tag-(. ).html$ tag.php?name=$1

  在浏览器地址栏输入: localhost/page-18.html 输出的是: 你的Action值为:page ID值为:18

1、假如你的服务器协助.htaccess,则无需安装,网址根目录下的.htaccess已经设置好法规。
规则(参考

复制代码

A.首先 在Apache  Apache模块中,开启 vhost_alias_moudle

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.webServer>
 <rewrite>
   <rules>
    <rule name="destoon_rewrite_0">
      <match url="^(.*).(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$" />
      <action type="Rewrite" url="/404.php" />
    </rule>
    <rule name="destoon_rewrite_1">
      <match url="^(.*)/file/(.*).php(.*)$" />
      <action type="Rewrite" url="/404.php" />
    </rule>
    <rule name="destoon_rewrite_2">
      <match url="^(.*)-htm-(.*)$" />
      <action type="Rewrite" url="{R:1}.php?{R:2}" />
    </rule>
     <rule name="destoon_rewrite_3">
     <match url="^(.*)/show-([0-9] )([-])?([0-9] )?.html$" />
     <action type="Rewrite" url="{R:1}/show.php?itemid={R:2}&page={R:4}" />
    </rule>
    <rule name="destoon_rewrite_4">
     <match url="^(.*)/list-([0-9] )([-])?([0-9] )?.html$" />
     <action type="Rewrite" url="{R:1}/list.php?catid={R:2}&page={R:4}" />
    </rule>
    <rule name="destoon_rewrite_5">
     <match url="^(.*)/show/([0-9] )/([0-9] )?([/])?$" />
     <action type="Rewrite" url="{R:1}/show.php?itemid={R:2}&page={R:3}" />
    </rule>
    <rule name="destoon_rewrite_6">
     <match url="^(.*)/list/([0-9] )/([0-9] )?([/])?$" />
     <action type="Rewrite" url="{R:1}/list.php?catid={R:2}&page={R:3}" />
    </rule>
    <rule name="destoon_rewrite_7">
     <match url="^(.*)/([A-za-z0-9_-] )-c([0-9] )-([0-9] ).html$" />
     <action type="Rewrite" url="{R:1}/list.php?catid={R:3}&page={R:4}" />
    </rule>
    <rule name="destoon_rewrite_8">
     <match url="^(com)/([a-z0-9_-] )/([a-z] )/(.*).html$" />
     <action type="Rewrite" url="index.php?homepage={R:2}&file={R:3}&rewrite={R:4}" />
    </rule>
    <rule name="destoon_rewrite_9">
     <match url="^(com)/([a-z0-9_-] )/([a-z] )([/])?$" />
     <action type="Rewrite" url="index.php?homepage={R:2}&file={R:3}" />
    </rule>
    <rule name="destoon_rewrite_10">
     <match url="^(com)/([a-z0-9_-] )([/])?$" />
     <action type="Rewrite" url="index.php?homepage={R:2}" />
    </rule>
    <rule name="destoon_rewrite_11">
      <match url="^([a-z] )/(.*).shtml$" />
      <action type="Rewrite" url="{R:1}/index.php?rewrite={R:2}" />
    </rule>
   </rules>
  </rewrite>  
 </system.webServer>
</configuration>

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteRule ^(.*)/archiver/((fid|tid)-[w-] .html)?*(.*)$ $1/archiver/index.php?$2&$4
RewriteRule ^(.*)/forum-([0-9] )-([0-9] ).html?*(.*)$ $1/forumdisplay.php?fid=$2&page=$3&$4
RewriteRule ^(.*)/thread-([0-9] )-([0-9] )-([0-9] ).html?*(.*)$ $1/viewthread.php?tid=$2&extra=page=$4&page=$3&$4
RewriteRule ^(.*)/space-(username|uid)-(. ).html?*(.*)$ $1/space.php?$2=$3&$4
RewriteRule ^(.*)/tag-(. ).html?*(.*)$ $1/tag.php?name=$2&$3

复制代码 代码如下:

选料“更新鸿营地产址”提交就能够。

iscuz! UCRUISERL 静态化 成效受到论坛所在服务器意况的制裁,在打开此意义在此以前,请依照你的 Web 服务器情状,选拔相应的情状安排情势。错误的装置有相当大希望造成服务器不可能运行大概作用失效。
一、Apache Web Server(独立主机用户)
先是显著你使用的 Apache 版本,还会有是或不是加载了 mod_rewrite 模块。
Apache 1.x 的用户请检查 conf/httpd.conf 中是不是存在如下两段代码:
   LoadModule rewrite_module     libexec/mod_rewrite.so
   AddModule mod_rewrite.c
Apache 2.x 的用户请检查 conf/httpd.conf 中是或不是留存如下一段代码:
   LoadModule rewrite_module     modules/mod_rewrite.so
比如存在,那么在安插文件(平日正是conf/httpd.conf)中参预如下代码。此时请务必注意,要是网址使用通过设想主机来定义,请务必加到设想主机配置,即 <VirtualHost> 中去,借使加在设想主机配置外界将恐怕无法选取。改好后将 Apache 重启。

   3.创建.htaccess 文件    建构.htaccess文件时要小心,不可能平素建,方法是透过记事本中的另存为菜单,在文书名窗口输入:“.htaccess”,然后点击保存。

本文由新浦京81707con发布于首页,转载请注明出处:设置方法详解,APACHE实现网址伪静态

关键词: 新浦京81707con

上一篇:destoon后台网站设置变成空白的解决方法,destoo

下一篇:没有了