配置了apache还是无法启用.htaccess,求帮忙看看

讨论程序使用中的问题
回复
头像
huangjunjie
帖子: 13
注册时间: 2016年 7月 12日 14:19

配置了apache还是无法启用.htaccess,求帮忙看看

帖子 huangjunjie »

在httpd.conf中的Options Indexes FollowSymLinks处修改了AllowOverride None 为 AllowOverride All ,
然后添加了 LoadModule rewrite_module modules/mod_rewrite.so ,并且在modules目录下可以超找到mod_rewrite.so这个文件,
.htaccess文件内容如下:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$/index.php/$1 [L]
</IfModule>
上传至根目录后,重新访问网站就报500Internal Server Error错误。
但是,我只要把这个.htaccess文件从根目录删除掉,再重新访问网站就可以了,
百度了很多遍,不知道哪里错误了。唉....
头像
m4go
帖子: 857
注册时间: 2010年 3月 29日 02:33
来自: https://www.vpshu.com
联系:

Re: 配置了apache还是无法启用.htaccess,求帮忙看看

帖子 m4go »

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

试一下这个,感觉你的伪静态倒数第2行$后面,少了个空格。
头像
huangjunjie
帖子: 13
注册时间: 2016年 7月 12日 14:19

Re: 配置了apache还是无法启用.htaccess,求帮忙看看

帖子 huangjunjie »

还是不行。还是下面这个错误。我再把.htaccess文件删除又好了。但是RewriteUrl就没法实现了,不管啥跳转都得跟个/index.php/。唉。实在不行,就这样将就用吧。
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
seaher
帖子: 7
注册时间: 2016年 12月 3日 14:10

Re: 配置了apache还是无法启用.htaccess,求帮忙看看

帖子 seaher »

太复杂了。你用云主机nginx的lamp,非常容易就能实现伪静态
头像
huangjunjie
帖子: 13
注册时间: 2016年 7月 12日 14:19

Re: 配置了apache还是无法启用.htaccess,求帮忙看看

帖子 huangjunjie »

m4go 写了:<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

试一下这个,感觉你的伪静态倒数第2行$后面,少了个空格。


今天加载到httpd.conf配置里,apache直接挂了,然后报错提示 httpd : Could not reliably determine the server's qualified domain name, using localhost.... s message 。 难道是要在hosts里加个地址么。。。求科普。
回复