douhuan6065 2014-09-02 00:04
浏览 45

由.htaccess文件导致的内部服务器错误[关闭]

I used the .htaccess codes below to redirect all request to the index files.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]

It worked well on some remote servers, but after moving one of the sites that use it to a new server, I get the internal server error:

Internal Server Error

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

Please contact the server administrator, 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.

What could be the cause of this error, and how can I fix it.

  • 写回答

1条回答 默认 最新

  • dongxuying7583 2014-09-02 00:22
    关注

    My guesses are that the mod_rewrite module in apache is not loaded. Check your apache configuration!

    To see if that's the case, and to avoid future errors, i always place this kind of code into a check like bellow. You can try it also, see if this works and if it doesn't give you an error anymore that means that mod_rewrite is off.

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
    
        # Checks to see if the user is attempting to access a valid file,
        # such as an image or css document, if this isn't true it sends the
        # request to index.php
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php [L,QSA]
    </IfModule>
    

    You can also check by using:

    <IfModule !mod_rewrite.c>
        # If we don't have mod_rewrite installed, send 404's
        # to a special page, so you can recognize the issue.
    
        ErrorDocument 404 /special_404_page.php
    </IfModule>
    

    Also you might wanna check the apache logs and see the error that it gives!

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。