apache2伪静态设置

  • bluetooth
  • [bluetooth]
  • 帖子作者
  • 离线
  • 新手上路
  • 新手上路
更多
2024-04-18 21:26 #184 bluetooth
新帖
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

登录注册一个帐号 参加讨论