I am using a shared web hosting service. Running phpinfo, I can see the Server API shows CGI/FastCGI rather than Apache 2 Handler.
In this article: http://docs.joomla.org/Should_PHP_run_as_a_CGI_script_or_as_an_Apache_module%3F
It says 'If your server is configured to run PHP as an Apache module, then you will have the choice of using either php.ini or Apache .htaccess files, however, if your server runs PHP in CGI mode then you will only have the choice of using php.ini files locally to change settings, as Apache is no longer in complete control of PHP.'
I think it's really strange that the rewrite rules in the .htaccess that I created have been working perfectly while it's running in CGI mode. Why is this happening?
The problem is not that Apache rewrite rules in the
.htaccess
file won't work when running PHP as a CGI vs. an Apache module. It's just you can't use the.htacess
file to set PHP values when it's ran as a CGI. Instead you have to have a separate php.ini file that has your settings changed in it. Within my own shared hosting account, which runs PHP as a CGI, I make use of FastCGI and have the following in my.htaccess
file:Then in my accounts
/cgi-bin/
directory I place themyphp.fcgi
script withchmod 755
containing:I still have a
<IfModule mod_rewrite.c>
section in my.htaccess
file to handle rewriting some old URI paths to the new URI structure to maintain old links that are cached in search engines.