1

好的,我会尽量保持简短

我最近接手了一个客户的网站管理工作。它托管在亚马逊 ec2 实例上。我需要将它从以前的管理员 ec2 实例迁移到我自己的一个。

我使用 akeeba 备份和 kickstart 来执行此操作,迁移似乎运行良好,但是 sef url 已损坏,并且由于许多链接似乎已被硬编码,因此该站点几乎无法使用。

它是在亚马逊 ec2 ami linux 上运行的 joomla 1.7.1 php 5.2.3 apache 2.2。

在 joomla global conf sef urls 中,但是当我打开 url 重写时一切都中断了。joomla 生成的链接与 url 中的 index.php 一起使用,但任何硬编码的链接都会因 404 错误而损坏。

.htaccess 文件名只是 .htaccess 而不是 .htaccess.txt。重写引擎已打开。

在我的 httpd.conf 中,我能找到的 mod_rewrite 的唯一实例是“LoadModule rewrite_module modules/mod_rewrite.so”,它没有被注释。allowoverride(任何时候出现)=“AllowOverride All”和accessfilename =“AccessFileName htaccess”。

我不知道该怎么做才能尝试解决这个问题,客户不会因为他页面上的一半链接突然中断而感到高兴

有任何想法吗?我仍然有 akeeba 备份文件,所以我可以重新开始,但我不知道如何设置 apache 以防止完全相同的事情再次发生

.htaccess

##
# @version              $Id: htaccess.txt 21101 2011-04-07 15:47:33Z dextercowl$
# @package              Joomla
# @copyright    Copyright (C) 2005 - 2011 Open Source Matters. All rights reser$
# @license              GNU General Public License version 2 or later; see LICE$
##

php_value memory_limit 128M



##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but $
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it$
# beginning of line), reload your site in your browser and test your sef url's.$
# it has been set by your server administrator and you do not need it set here.
##

## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

## Mod_rewrite in use.

RewriteEngine On

## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.

## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
## End - Custom redirects

##
# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).
##

RewriteBase /
php_value upload_max_filesize 32M
php_value post_max_size 32M
php_value memory_limit 256M

## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the request is for something within the component folder,
# or for the site root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$$
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.

编辑:我也迁移了许多其他 joomla 站点,就像我做这个一样,它们工作正常,唯一的区别是它们被迁移到了诸如 rackspace 云站点之类的解决方案。该客户坚持使用 amazon ec2,这意味着我必须设置服务器,我确信这是问题所在

edit2:我刚刚更新到 2.5.14 并且有同样的问题

4

2 回答 2

1

好的,这不是 Joomla 2.5.htaccess文件,它会给你 404。我在当前 2.5 版本上创建了一个变体,并添加到您的其他php设置中。它适用于我的开发机器(你的机器没有)。

##
# @package      Joomla
# @copyright    Copyright (C) 2005 - 2012 Open Source Matters. All rights reserved.
# @license      GNU General Public License version 2 or later; see LICENSE.txt
##

##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
##

## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

## Mod_rewrite in use.

RewriteEngine On

## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.

## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
## End - Custom redirects

##
# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).
##

# RewriteBase /

## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the request is for something within the component folder,
# or for the site root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.

php_value upload_max_filesize 32M
php_value post_max_size 32M
php_value memory_limit 256M
于 2013-08-21T02:43:31.170 回答
0

这似乎是一个 .htaccess 问题,但如果是这种情况,您会收到 500 个错误,而不是 404。

适用于一种设置的 .htaccess 指令可能会在另一种设置上产生冲突,您可以尝试手动修复它(在您的 apache error_log 中可能有错误的痕迹),或者使用 fastjoomla 的小助手试一试,它有几个例程可以尝试和让 .htaccess 为您工作:http: //www.fasterjoomla.com/repository/littlehelper

于 2013-08-20T06:55:14.140 回答