除主页外,我找不到404页面

时间:2016-07-03 08:34:10

标签: php .htaccess

我使用kohana框架创建了我的网站,并在godaddy中托管。我在除主页之外的所有链接中都找不到404页面错误。我在这里附上了.htaccess文件。请提供有关此用途的任何想法。

# Turn on URL rewriting
RewriteBase /
RewriteEngine On

# Installation directory
#RewriteBase /kohana/

# Protect application and system files from being viewed
RewriteRule ^(application|system) - [F,L]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
# RewriteRule .* index.php/$0 [PT,L]

RewriteRule ^(.*)$ index.php?/$0 [L]

3 个答案:

答案 0 :(得分:0)

确保.htaccess与所有.php文件位于同一目录中。 / public_html /或像这样的文件夹。

工作示例

RewriteEngine On

//Optional: Redirect www to non www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

//Optional: Redirect http:// to https://
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

//Edit the URL (Without parameter)
RewriteRule ^login/?$ login.php [QSA]
RewriteRule ^logout/?$ logout.php [QSA]

//Edit the URL (With parameter)
RewriteRule ^user/edit/([0-9]*)/?$ user_edit.php?user_id=$1 [QSA]

如果您在GoDaddy上托管,您通常不需要为index.php文件创建.htaccess。

答案 1 :(得分:0)

它发生在我身上一次,我不知道它是否会对你造成同样的问题,但我知道一些托管服务器使用区分大小写的网址

实施例: 如果你的文件有这个名字=“Login.php” 如果你尝试访问它像这样=“login.php”它将无法工作,这也适用于文件夹的名称。

答案 2 :(得分:0)

看起来你的最后一行中有一个不属于那里的问号,它应该是:

from itertools import permutations seq = [5, 9, 8, 2, 1] plist = [] root = seq[0] left = filter(lambda x: x > root, seq) right = filter(lambda x: x < root, seq) for pseq in permutations(seq[1:]): pseq = (root,) + pseq if list(filter(lambda x: x > root, pseq)) == left and list(filter(lambda x: x < root, pseq)) == right: plist.append(pseq) print plist

或者尝试:

RewriteRule ^(.*)$ index.php/$0 [L]