zoukankan      html  css  js  c++  java
  • linux下apache各种跳转(包括伪静态)的配置

    1.404跳转:

      vi /etc/httpd/conf/httpd.conf

      在虚拟主机配置里添加一行:ErrorDocument 404 /404.html 

    2.301跳转:

      1)将不带www的跳转到带www的:在根目录下新建.htaccess文件,写入:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^manyi.cc [NC]
    RewriteRule ^(.*)$ http://www.manyi.cc/$1 [L,R=301]

      2)重定向到新域名:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^(.*)$ http://www.manyi.cc/$1 [L,R=301]

      3)在httpd.conf配置文件中配置:

    <VirtualHost *:80>
    ServerName manyi.cc
    RedirectMatch permanent ^/(.*) http://www.manyi.cc/$1
    </VirtualHost>

     3.使用正则进行301伪静态配置:(将news.php?id=123这样的地址转向到news-123.html

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^news-(.+)\.html$ news.php?id=$1
  • 相关阅读:
    cookie,session,django中间件,csrf回顾
    CSRF
    django中间件
    cookie与session
    form组件简单回顾
    分页器组件与form组件
    ajax回顾
    AJAX
    python魔法方法详解
    python静态方法类方法属性方法
  • 原文地址:https://www.cnblogs.com/thinksasa/p/2944086.html
Copyright © 2011-2022 走看看