youngjuning / issues

一寸欢喜 - 怕什么真理无穷,进一寸有一寸的欢喜
https://youngjuning.js.org
44 stars 4 forks source link

apache 配置 mod_rewrite #166

Open youngjuning opened 5 years ago

youngjuning commented 5 years ago

1.服务器配置

操作系统:Ubuntu 14.04 lts 云服务器

2.准备工作

打开apache2的mod_rewrite(apache默认不开启这个模块) 写有phpinfo()函数的php文件

3.步骤

(1)在命令行下执行find / -name "rewrite"查找mod_rewrite.so文件,如果找到,说明看来此模块已经有了。

(2)在网页中打印phpinfo(),查找mod_rewrite,没有,看来apache2并没有开启mod_rewrite模块。

(3) sudo a2enmod rewrite执行成功。提示重启。

(4)执行/etc/init.d/apache2 restart重启apache2。

(5)刷新页面,点击文章链接,无效,404页面出现了。

(6)cd  /etc/apache2/mods-enabled,ls -l发现   rewrite.load是日期最新的文件,证明a2enmod rewrite是生效了。

(7)进入/etc/apache2/ 修改apache2.conf。在其中搜索AllowOverride,将None改为All,保存退出。重启apache。

4.外链

http://blog.163.com/squall_smile/blog/static/60349840201328111843621/