|
|
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>
|
|