您的位置:首页 > 其它

.htaccess文件的正确编写方式

2016-04-07 17:35 239 查看
今天在windows系统编写了一个.htaccess文件, 发现在apache中开放了 modules/mod_rewrite.so以及将AllowOverride None 修改成AllowOverride All. 但访问还是会出现:


Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


异常. 这让我感到非常不解.异常的苦恼.然后在Google, baidu,.com上搜索各种答案, 然并卵.所有的答案都指向开放mod_rewrite.so和修改 AllowOverride None.

由于我本人非常喜欢用Mac电脑, 但是我本人是做Java的,公司没有给配置Mac电脑, 但是我创建文件的习惯一直都是 Mac系统上的UTF-8格式的文件.才导致我出现的这个错误.我现在就把创建.htaccess文件的步骤以及注意一一道来.

第一步:

开放 modules/mod_rewrite.so

第二步:

将AllowOverride None 修改成 AllowOverride All

第三步:

检查创建的.htaccess文件的格式, 必须一定要与你的系统是一样的. 如果是windows,你的文件就一定要是widnows,如果是Linux就一定要是Linux的.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: