欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

openSUSE中启用apache mod_rewrite

发布时间:2024/4/17 编程问答 49 豆豆
生活随笔 收集整理的这篇文章主要介绍了 openSUSE中启用apache mod_rewrite 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

1. 编辑 "/etc/sysconfig/apache2"文件

    查找 APACHE_MODULES,你应该会找到一行像

APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_core authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl socache_shmcb userdir reqtimeout authn_core php7 php5 version"

2. 添加 "rewrite"在这行的""中,

如:

APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_core authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl socache_shmcb userdir reqtimeout authn_core php7 php5 version rewrite"

3.  运行 sudo systemctl restart apache2 重启apache2

现在 apache2 rewrite已经启用了。

4.使用你喜欢的编辑器编辑 /etc/apache2/default-server.conf 文件

5. 查找 AllowOverride -- 这应该在  <Directory "/srv/www/htdocs">  下面

6. 将 AllowOverride None 修改为 AllowOverride All

7. 保存文件修改并退出

8. 运行 sudo systemctl restart apache2 重启apache2

 

可以在 /srv/www/htdocs 中一个 info.php文件,使用你喜欢的编辑器写入以下内容:

<?php phpinfo(); ?>

保存文件修改并退出,使用浏览器浏览 如:http://localhost/info.php , 查找 rewrite ,你应该就能找到它在页面中,说明rewrite启用了。

 

参考链接:

  • Enable mod_rewrite on SuSE Linux
  • Enable Apache mod_rewrite module on OpenSuSE
  • openSUSE下配置Apache Rewrite允许访问.htaccess文件
  • 转载于:https://www.cnblogs.com/fsong/p/6759686.html

    总结

    以上是生活随笔为你收集整理的openSUSE中启用apache mod_rewrite的全部内容,希望文章能够帮你解决所遇到的问题。

    如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。