找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 拇指 mztk
查看: 13592|回复: 0

apche www跳转

[复制链接]

134

主题

52

回帖

4913

积分

版主

积分
4913
发表于 2022-10-18 22:09:51 | 显示全部楼层 |阅读模式
apche 不带www跳转www

apache设置目录Extensions\Apache2.4.39\conf\vhosts找到www.xxx.com_80.conf
<VirtualHost *:80>
    DocumentRoot "C:/xxx.com"
    ServerName www.xxx.com
    ServerAlias xxx.com
    FcgidInitialEnv PHPRC "C:/phpstudy_pro/Extensions/php/php7.3.4nts"
    AddHandler fcgid-script .php
    FcgidWrapper "C:/phpstudy_pro/Extensions/php/php7.3.4nts/php-cgi.exe" .php
  <Directory "C:/xxx.com">
      Options FollowSymLinks ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
      Require all granted
          DirectoryIndex index.php index.html
  </Directory>
    RedirectMatch permanent ^/(.*) https://www.xxx.com/$1
</VirtualHost>



下面伪静态

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^xxx.com [NC]
RewriteRule ^(.*) http://www.xxx.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|再加计算机 ( 鲁ICP备19060125号-10|鲁公网安备37028102001711号 )

GMT+8, 2026-9-11 18:34 , Processed in 0.078562 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表