Godaddy mod_rewrite

I have two Godaddy accounts now. One is for a dedicated server, the other is for a deluxe share hosting package. Actually I do not need any share hosting once I get a dedicated server, but someone bought this for me, so I spent some time inspecting how good / bad it is.

I should regard myself as a Godaddy loyal client. I am 100% satisfied with their dedicated server service, and also, Godaddy domain management is the most powerful and convenient I have ever seen. However, Godaddy share hosting is definitely not something workable for me.

I am recently struggling at setting up magento in Godaddy share hosting. Magento setup is 50% successful. I mean, magento can run homepage, wishlist, popular search, etc all right, but it run into blank pages at many points, e.g. about us, customer service, etc. Initially I thought it was mod_rewrite problem, so I used phpinfo to check. I did not find mod_rewrite enabled. I quickly installed wordpress to double check, and if I enable wordpress search engine friendly url features, it runs into 404 error. I searched Godaddy Knowledge Base (FAQ centre). It says:

Mod_rewrite is an Apache web server module installed on all of our Linux servers by default; it does not have to be installed or enabled. Our Linux hosting accounts support most mod_rewrite functionality.

You do not need to enable mod_rewrite in your httpd.conf, as this is handled at a global level. All you need to do is add the desired code to the body of your .htaccess file.

For more information about mod_rewrite see the Apache Module mod_rewrite documentation.

NOTE:The .htaccess file containing the rewrite rules must be in the same directory as the target files.

This article did not help me. So I had to submit a ticket. Within several hours, I got the reply (I am satisfied with Godaddy support reponse speed) but it only contained the same words as the answer from Godaddy Knowledge Base. I googled “godaddy mod_rewrite” after I could not get a clear reply from Godaddy. I should have googled it earlier because soon I found someone mentioned rewrite rules in .htaccess with Godaddy share hosting DO NOT TAKE IMMEDIATE EFFECT.

This solved all my queries. Although I still do not know how Godaddy hide mod_rewrite from phpinfo, after several hours of being installed, wordpress is working properly.

However, magento is still not running properly. I assume it has nothing to do with mod_rewrite settings. By all means, to my opinion, magento is not suitable to run on a share hosting package. Installing magento on Godaddy share hosting account is only for my curiosity. I have been running magento successfully on my dedicated server.



我在了解wordpress的过程遇到这么点小麻烦:custom permalink structure为/%post_id%/%postname%/(其实seo并非非得这么设置,但这个设置是我们价值£750每月的引擎优化专家推荐的,姑且采用)。


但我有个毛病,明知不可为而为之,就是想看看什么后果。结果我知道了:后果很严重。一旦修改了permalink,wordpress就自动生成一个.htaccess,不管服务器是否支持,也不管blog是否真的需要这个.htaccess。由于服务器没有加载mod_rewrite,所以发生500 server error。于是我删掉了.htaccess,然后在后台想把permalink改回Default,wordpress不够体贴的地方就暴露出来了:只要一提交permalink的值,不管这个新值是什么,wordpress就自动生成.htaccess,这样我的服务器马上就500,php肯定就中止执行了,数据库就无法更新了。这个鸡先生蛋、还是蛋先生鸡的问题,我最后是直接操纵数据库才解决的(wordpress的数据库结构还是挺清晰的,我没看什么资料,凭着直觉找到wp_options table,再找到permalink_structure,删掉option_value就可以了)。


题外话:wordpress的permalink基于url rewrite,要求服务器服务器是apache+mod_rewrite,适用性小。要是谁能开发一个plugin,基于404错误捕获做permalink,一定会在广大小空间业主群里有市场。不过我不会想着去做这件事,从基于url rewrite到基于404,技术上是种倒退。要向前看,不是向钱看。