Codeigniter 404页面显示在实时服务器上

时间:2017-05-07 18:09:27

标签: php apache .htaccess codeigniter mod-rewrite

我知道这里已有很多这些,但没有给出任何答案似乎有帮助。

所以我的情况是我在我的本地服务器(XAMPP)上使用codeigniter构建了一个站点,在上传到我的实时服务器(使用Hospresto)并进行配置之后,我可以让我的主页显示,但其他一切都返回404。

这个网站位于我设置的另一个codeigniter网站的开发文件夹中(工作正常)。所以我无法工作的网站看起来像www.website1.co.uk/dev/website2/inner-page

控制器capitilisation并没有什么区别,我更改了$ config ['uri_protocol'] ='AUTO'; to ='REQUEST_URI'

我似乎无法从我的主机端访问任何httpd conf文件(不是我能看到的)而我的.htaccess是

# <IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

RewriteRule ^admin(/?)$ /hnm/index.php/admin [L]

### Rewrite Images ###
RewriteRule ^images/gallery/large/(.*)$ /hnm/image.php?image=/img/_gallery/$1&width=1000
RewriteRule ^images/gallery/admin/(.*)$ /hnm/image.php?image=/img/_gallery/$1&width=149&cropratio=1:1
RewriteRule ^images/gallery/(.*)$ /hnm/image.php?image=/img/_gallery/$1&width=420&cropratio=3:2
RewriteRule ^images/banners/(.*)$ /hnm/image.php?image=/img/_gallery/$1&width=1200
RewriteRule ^images/blog/thumb/(.*)$ /hnm/image.php?image=/img/_blog/$1&width=320&cropratio=1:1 [L]
RewriteRule ^images/blog/(.*)$ /hnm/image.php?image=/img/_blog/$1&width=320&cropratio=1:1 [L]

RewriteRule ^images/avatars/(.*)$ /hnm/image.php?image=/img/_users/$1&width=100&cropratio=1:1 [L]
RewriteRule ^images/clients/(.*)$ /hnm/image.php?image=/img/_clients/$1&width=200&cropratio=1:1 [L]


### Canonicalize codeigniter URLs

# If your default controller is something other than
# "welcome" you should probably change this
RewriteRule ^(welcome(/index)?|index(\.php)?)/?$ / [L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]

# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]


# Enforce NO www

#RewriteCond%{HTTP_HOST} ^ www [NC]     #RewriteRule ^(。*)$ http://domain.tld/ $ 1 [L,R = 301]

###

# Removes access to the system folder by users.
# Additionally this will allow you to create a System.php controller,
# previously this would not have been possible.
# 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]



# 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 ^(.*)$ /hnm/index.php/$1 [L]

# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php

所以我现在完全失去了 - 如果有人能帮助我,我会非常感激。

由于

1 个答案:

答案 0 :(得分:0)

所以可能有一种方法可以关闭问题,但我不知道,但无论如何我在这里找到了答案

Codeigniter 404 Error On Live Server