joomla 1.7.1迁移后url重写问题(现2.5.14)

时间:2013-08-20 01:23:47

标签: apache url-rewriting apache2 joomla2.5 joomla1.7

好的,我会尽量保持这个简短

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

我使用了akeeba备份和kickstart这样做,并且迁移似乎工作正常但是sef网址被破坏并且它使网站几乎无法使用,因为许多链接似乎已被硬编码。

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

在joomla global conf sef urls中的

是打开的,但是当我打开url重写时,一切都会中断。 joomla生成的链接与url中的index.php一起使用,但任何硬编码链接都会被404错误打破。

.htaccess文件名只是.htaccess而不是.htaccess.txt。 RewriteEngine已开启。

在我的httpd.conf中,我能找到的唯一一个mod_rewrite实例是'LoadModule rewrite_module modules / mod_rewrite.so',它是未注释的。 allowoverride(任何时候出现)=“AllowOverride All”andaccessfilename =“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网站并且它们工作正常,唯一的区别是它们被迁移到像机架云网站这样的解决方案。这个客户坚持亚马逊ec2,这意味着我必须设置服务器,我相信是问题是

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

2 个答案:

答案 0 :(得分: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

答案 1 :(得分:0)

这似乎是一个.htaccess问题,但如果是这样的话,你会得到500个错误,而不是404。

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