我的htaccess无法在000webhost中运行

时间:2015-11-20 05:00:21

标签: php .htaccess codeigniter

RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|assets|woff|eot|img|css|js|resources|robots\.txt)   
RewriteRule ^(.*)$ index.php/$1 [L]

这是我在000webhost上与Codeigniter一起使用的.htaccess文件,它工作得很好。

我现在已经更新了每个文件,但同样的.htaccess无效。

我现在收到“500内部服务器错误”。 可能是什么问题?

我的网址为futsal-groove.net16.net/home

6 个答案:

答案 0 :(得分:0)

使用此

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

CodeIgniter URLs .htaccess in codeigniter.com

答案 1 :(得分:0)

试试这个

<script src="https://code.angularjs.org/1.4.3/angular-animate.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>
<!DOCTYPE html>
<html >

<head>
  <meta charset="utf-8" />
  <title>AngularJS Demo</title>
  <script>
    document.write('<base href="' + document.location + '" />');
  </script>
</head>

<body>
  <div ng-app="myApp" ng-controller="myCtrl">
    <double-tag-manager tags="tags" primary="primaryFoods" secondary="secondaryFoods" user-primary="userCategory" user-secondary="userFood">
    </double-tag-manager>
  </div>
</body>

</html>

答案 2 :(得分:0)

htaccess文件应放在主目录

application
system
.htaccess
index.php

试试此代码

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

在您的配置文件

$config['base_url'] = 'http://www.example.com/';
$config['index_page'] = '';

答案 3 :(得分:0)

尝试使用RewriteBase指令或在Rewrite target

中使用absolue路径
RewriteEngine On


RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [NC,L]

注意:000webhost服务器使用虚拟用户主目录,因此在Rewrite target中使用相对路径时添加RewriteBase指令非常重要,否则将找不到404。

来源:

https://www.000webhost.com/faq.php?ID=16

答案 4 :(得分:0)

使用此

更改您的htaccess代码
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

答案 5 :(得分:0)

某些安装需要采用不同的方法来解决此问题。它可以是PHP版本,apache版本或其他东西。在某些php安装中,在index.php之后在.htaccess文件中添加问号是必要的尝试这些解决方案:

# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /
# If fuel is not a level up
# RewriteBase /public

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?/$1 [L]
# Notice the ? after index.php

RewriteRule ^(.*)$ index.php?$1 [L]
# Notice the fact that the slash has been removed after the ?

#Other possible setups:

RewriteRule ^(.*)$ /index.php/$1 [L]
# Notice the leading slash added before index.php

找到它here

相关问题