WAMP的Apache mod_rewrite问题 - 显示错误404未找到 - 带有SEF URL的Joomla 1.5.14

时间:2009-10-14 18:50:37

标签: apache mod-rewrite joomla1.5 wamp joomla-sef-urls

我是Joomla和WAMP环境的新手。我正在使用WAMP环境:

  • 使用SP2赢取Srv 2003 R2(Std Ed)以及所有最新更新
  • Apache 2.2.9
  • PHP 5.2.6
  • Joomla 1.5.14

我想用Joomla SEF URL启用mod_rewrite但它不能一起工作。

  • 如果我将“SEF网址”和“将后缀添加到网址”设为是,则可以使用 结果:/index.php/page.html

  • 如果我将'mod_rewrite'和'添加后缀添加到网址'设置为是,则不会出现任何错误(不确定它是否按照它假定的方式工作)。
    结果:/index.php?option=com_content&view=article&id=3&Itemid=5

  • 如果我将“SEF网址”和“mod_rewrite”设置为“是”,则会显示“404 Not Found”错误。
    结果:未找到|在此服务器上找不到请求的网址/pagename

  • 如果我设置'SEF网址'+'mod_rewrite'+'将后缀添加到网址'为是,而不是它给我“404 Not Found”错误。
    结果:未找到|在此服务器上找不到请求的网址/pagename.html

我使用的是Joomla提供的默认.htaccess,代码如下:

 

##  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 set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a  tag in URL
RewriteCond %{QUERY_STRING} (\|%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})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

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

 RewriteBase /abc  
# /abc is a sub-directory of joomla install in htdocs

########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section



在httpd.conf中

  • 我有LoadModule rewrite_module modules/mod_rewrite.so有效(未注释#
  • 在Apache的 modules 文件夹中有 mod_rewrite.so

我不确定我还需要做些什么才能让它发挥作用。我查看了几乎所有论坛的帖子和博客。然而,没有任何帮助。

我也有PHP_MAILER问题,但这并不像这一样重要。我感谢您的帮助。如果您需要更多详细信息来解决此问题,请与我们联系。

亲切的问候

DM

1 个答案:

答案 0 :(得分:8)

我找到了问题的答案:我在httpd.conf中添加了目录,但AllowOverride设置为None而不是All以允许.htaccess生效。

AllowOverride所有需要在那里使用apache来处理.htaccess。代码看起来像:

<Directory "D:/Apache/htdocs/joomla">
    AllowOverride all
    Options None
    Order allow,deny
    Allow from all
</Directory>

随着上述改变,需要有“RewriteBase /”
(设置为on,即ununcomment RewriteBase /)