2014-03-12 80 views
1

我正在將現有的codeigniter網站從MediaTemple共享服務器移動到Dreamhost VPS服務器。我已經建立了新服務器的鏡像來查看站點而無需切換DNS;你可以看到它herecodeigniter站點在服務器移動後返回404錯誤

我試圖切換DNS,但問題依然存在。

正如你所看到的,它返回一個404錯誤。如果我刪除了htaccess文件,主頁將會出現,但是沒有一個html頁面可以工作。我認爲這與htaccess文件中的RewriteCond和RewriteRule語句有關。

這裏是htaccess文件:

AddHandler php-stable .php 
php_flag allow_url_fopen on 
# php_flag extension_dir=/home/86983/data/lib/php 
# php_flag extension=zip.so 


Options +FollowSymLinks 
RewriteEngine on 

# RewriteCond $1!^(js|css|images|license\.txt|user_guide|admin|phpMyAdmin|uploads|ornaments_sitemap2_25_09\.xml|sitemap\.xml|robots\.txt|quickscript\.php|paypal_ipn\.php|test\.php|sitedown\.php) 
# RewriteRule ^(.*)$ http://www.ornaments.com/sitedown\.php [L] 

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

RewriteCond $1 !^(admin|backupForPhpMyAdmin|blog|change_page_name\.php|css|favicon\.ico|images|index\.php|js|license\.txt|ornaments_sitemap2_25_09\.xml|paypal_ipn\.php|phpMyAdmin|uploads|quickscript\.php|robots\.txt|sitemap\.xml|sub-domains|test\.php|testblog\.php|url_checker|user_guide|tinymy\.php) 
RewriteRule ^(.*)$ /index.php/$1 [L] 

# RewriteCond %{HTTP_HOST} ^s86983\.gridserver\.com$ [NC] 
# RewriteRule (.*) http://www.s86983\.gridserver.com/$1 [R=301,L] 
# 
# RewriteCond $1 !^(blog|index\.php|js|css|images|license\.txt|user_guide|admin|phpMyAdmin|uploads|ornaments_sitemap2_25_09\.xml|sitemap\.xml|robots\.txt|quickscript\.php|paypal_ipn\.php|test\.php|backupForPhpMyAdmin) 
# RewriteRule ^(.*)$ /index.php/$1 [L] 

注:我沒有建立這個網站,我只是稍微熟悉一般的笨和PHP。任何幫助將不勝感激。

+0

嘗試從您的.htacces文件中刪除前兩行 –

+0

我刪除了前兩行,現在當我刷新頁面時得到此消息:「沒有指定輸入文件。」 – user3403950

回答

1

我建議你在這個htaccess的複製:

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule .* index.php/$0 [PT,L] 
</IfModule> 

<IfModule !mod_rewrite.c> 
    #LoadModule rewrite_module modules/mod_rewrite.c 
    # Without mod_rewrite, route 404's to the front controller 
    ErrorDocument 404 /index.php 
</IfModule> 
+0

謝謝,我將它複製到htaccess中,就像其他事情一樣。我仍然收到404錯誤。 – user3403950

0

我們解決了這一通過從工作現場的Opencart的一部分的一個替換htaccess文件。這個文件看起來是這樣的:

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 

# 2. In your opencart directory rename htaccess.txt to .htaccess. 

# For any support issues please visit: http://www.opencart.com 

Options FollowSymlinks 

# Prevent Directoy listing 
Options -Indexes 

# Prevent Direct Access to files 
<FilesMatch "\.(tpl|ini|log)"> 
Order deny,allow 
Deny from all 
</FilesMatch> 

# SEO URL Settings 
RewriteEngine On 
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie./becomes /shop/ 

RewriteBase/
RewriteRule sitemap.xml /index.php?route=feed/google_sitemap 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^?]*) /index.php?_route_=$1 [L,QSA] 



### Additional Settings that may need to be enabled for some servers 
### Uncomment the commands by removing the # sign in front of it. 
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that. 

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it: 
#php_flag register_globals off 

# 2. If your cart has magic quotes enabled, This may work to disable it: 
# php_flag magic_quotes_gpc Off 

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try 
# php_value upload_max_filesize 999M 

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields 
# php_value post_max_size 999M 

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields 
#php_value max_execution_time 200 

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields 
# php_value max_input_time 200 
Options +FollowSymLinks 
RewriteCond %{HTTP_HOST} ^www.shop.ornaments.com [NC] 
RewriteRule ^(.*)$ http://shop.ornaments.com/$1 [R=301,L] 

我不明白爲什麼它的工作,哪些可能仍然被打破,我們現在還無法看到,但到目前爲止,它看起來不錯。

相關問題