zoukankan      html  css  js  c++  java
  • apache tomcat 伪静态 struts2 伪静态

    如果没有用apache就需要下载urlrewritefilter包,这种方法所有的请求都会先转到UrlRewriteFilter类中进行处理,效率较低

    一般把伪静态放在apache中进行处理,步骤如下:

    1.  打开apache/conf/httpd.conf文件

    找到如下行,将前面的注释符#删除 

     #LoadModule rewrite_module modules/mod_rewrite.so

    变为

     LoadModule rewrite_module modules/mod_rewrite.so

    2. 搜索AllowOverride 找到如下行

        # 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

     将All 改为 None(注意如果搜索httpd.conf文件,里面有多个AllowOverride关键字,要设置htdocs路径的那个)

    3. 在apache/htdocs路径下添加.htaccess文件,文件内添加伪静态重写代码,如

    RewriteEngine On 
    RewriteRule Location.html Location.action
    RewriteRule ^(.*)ChangeCity-([0-9]+)\.html$ $1/ChangeCity.action?countyId=$2

    RewriteRule ^(.*)list-([0-9]+)-([0-9]+)\.html$ $1/plus/list.php?typeid=$2&PageNo=$3 

    RewriteCond %{HTTP_HOST} ^[a-z0-9\-]+\.lujin\.com$
    RewriteCond %{HTTP_HOST} !^(www|bbs)\.lujin\.com$
    RewriteRule ^/?$ /%{HTTP_HOST}

    RewriteRule ^/([a-z0-9\-]+)\.lujin\.com/?$ /member/index.php?uid=$1 [L] 

  • 相关阅读:
    docker安装kibana
    docker 安装elasticsearch
    redis常用命令
    判断CheckBox,select是否被选中
    里面的div怎么撑开外面的div,让高度自适应
    超链接,表单jquery提交方式
    SSM框架的sql中参数注入(#和$的区别)
    springmvc接收值的方式
    mysql语法顺序
    js创建对象并赋值其属性
  • 原文地址:https://www.cnblogs.com/kevinge/p/2453176.html
Copyright © 2011-2022 走看看