Godaddy共享托管中的Magento .htaccess错误

问题描述

| 我在安装magento时启用了apache mod_rewrite的Godaddy共享托管中安装了Magento。安装完成,首页加载良好。但是,当我尝试访问任何其他页面时,当我使用www.myshop.com/admin或www.myshop.com/sony-vaio-vgn-txn27n-b访问时,每页都会给我“ 500 Internal Server Error” -11-1-notebook-pc.html。 但是,当我访问www.myshop.com/index.PHP/admin和www.myshop.com/index.PHP/sony-vaio-vgn-txn27n-b-11-1-notebook-pc.html时,效果很好。 Godaddy的支持人员告诉我,他们也已在共享托管中启用了Apache mod_rewrite。他们建议我.htaccess中存在一些配置错误。谁能帮我。我在这里发布.htaccess。
############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi PHP binary file name
## it might be /cgi-bin/php-cgi

#    Action PHP5-cgi /cgi-bin/PHP5-cgi
#    AddHandler PHP5-cgi .PHP

############################################
## GoDaddy specific options

   Options -MultiViews

## you might also need to add this line to PHP.ini
##     cgi.fix_pathinfo = 1
## if it still doesn\'t work,rename PHP.ini to PHP5.ini

############################################
## this line is specific for 1and1 hosting

    #AddType x-mapp-PHP5 .PHP
    #AddHandler x-mapp-PHP5 .PHP

############################################
## default index file

    DirectoryIndex index.PHP

<IfModule mod_PHP5.c>

############################################
## adjust memory limit

#    PHP_value memory_limit 64M
    PHP_value memory_limit 256M
    PHP_value max_execution_time 18000

############################################
## disable magic quotes for PHP request vars

    PHP_flag magic_quotes_gpc off

############################################
## disable automatic session start
## before autoload was initialized

    PHP_flag session.auto_start off

############################################
## enable resulting html compression

    #PHP_flag zlib.output_compression on

###########################################
# disable user agent verification to not break multiple image upload

    PHP_flag suhosin.session.cryptua off

###########################################
# turn off compatibility with PHP4 when dealing with objects

    PHP_flag zend.ze1_compatibility_mode Off

</IfModule>

<IfModule mod_security.c>
###########################################
# disable POST processing to not break multiple image upload

    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

<IfModule mod_deflate.c>

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

    # Insert filter on all content
    ###SetoutputFilter DEFLATE
    # Insert filter on selected content types only
    #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

    # netscape 4.x has some problems...
    #browserMatch ^Mozilla/4 gzip-only-text/html

    # netscape 4.06-4.08 have some more problems
    #browserMatch ^Mozilla/4\\.0[678] no-gzip

    # MSIE masquerades as netscape,but it is fine
    #browserMatch \\bMSIE !no-gzip !gzip-only-text/html

    # Don\'t compress images
    #SetEnvIfNoCase Request_URI \\.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don\'t deliver the wrong content
    #Header append vary User-Agent env=!dont-vary

</IfModule>

<IfModule mod_ssl.c>

############################################
## make HTTPS env vars available for CGI mode

    SSLOptions StdEnvVars

</IfModule>

<IfModule mod_rewrite.c>

############################################
## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

############################################
## you can put here your magento root folder
## path relative to web root

    RewriteBase /home/content/33/7605133/html/

############################################
## workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files,directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite everything else to index.PHP

    RewriteRule .* index.PHP [L]

</IfModule>


############################################
## Prevent character encoding issues from server overrides
## If you still have problems,use the second line instead

    AddDefaultCharset Off
    #AddDefaultCharset UTF-8

<IfModule mod_expires.c>

############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires

    ExpiresDefault \"access plus 1 year\"

</IfModule>

############################################
## By default allow all access

    Order allow,deny
    Allow from all

############################################
## If running in cluster environment,uncomment this
## http://developer.yahoo.com/performance/rules.html#etags

    #FileETag none
    

解决方法

        你的问题是这条线 RewriteBase / home / content / 33/7605133 / html / 查看该行上方的评论 \“您可以在此处放置您的magento根文件夹 相对于Web根目录的路径\“ 因此它必须相对于webroot,因此,如果您的webroot是/ home / content / 33/7605133 / html / 我认为那是那时,您需要将该行更改为 RewriteBase /     ,        我刚刚在Godaddy虚拟主机上完成了magento安装,并遇到了同样的问题。 解决方法是执行以下操作: 在godaddy主机管理面板中,调整php版本以使其与magento安装的版本相匹配(在我的情况下为magento 1.9.1.0 CE-社区版),我已将其更改为5.4。 然后在您的magento \基本目录的.htaccess文件中,更改rewrite基本指令以指向相对路径,如下所示: RewriteBase / 在同一文件上,在文件末尾添加以下内容: RewriteRule ^ index.php /(.*)$ [L] 在Godaddy虚拟主机的根目录下的php5.ini文件中添加以下指令(如果不存在,则使用指定的确切名称创建一个): [源代码语言= \“ php \”] register_globals =开 allow_url_fopen =开启 cgi.fix_pathinfo = 1 [/源代码] 就是这样(不要忘记保存所有文件更改并关闭使用的文件。 有关完整的解释和更详细的步骤,请转到下面的文章。 文章