apache2伪静态设置

  • []
  • Topic Author
  • Visitor
  • Visitor
18 Apr 2024 21:26 #184 by
New Topic
apache2的默认站点主目录:/var/www/html/
以下皆使用root权限运行

1.加载rewrite模块
ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load

2.apache2主配置文件修改
默认主配置文件位置为/etc/apache2/apache2.conf
将/etc/apache2/apache2.conf中所有<Directory></Directory>之间的
AllowOverride None将None改为All

3.在网站的目录下建立.htaccess文件
.htaccess文件内容如下

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

                        
原文链接:https://blog.csdn.net/xulei1132562/article/details/122856977

Please Log in or Create an account to join the conversation.

Login

$5.00
No vote
Add to cart