Closed jmarjie closed 13 years ago
Thanks for posting this. I like this solution. I will make this update and test locally. It looks like this will solve the problem with the mod_rewrite check when PHP is running as cgi.
Do you know if SetEnv is fairly universal, or do we need to add any kind of check that Apache will let us do it first? I had problems with another similar type of setting (php_flag and php_value), where I discovered that it would cause some servers to throw a 500 error ... which apparently can be solved with a
Thanks, Ryan
From what I have seen on the net and the Apache docs SetEnv has been available starting with version 1.1. When I was looking around for a resolution to the mod_rewrite issue someone mentioned that this would be a robust solution. I am not sure how other CMSs handle this as I have not thumbed through many of them more then briefly.
closing this issue since your solution was added to PW a few weeks ago. thanks for your help.
mod_rewrite check failing without function apache_get_modules(). Patch attached.
diff --git a/htaccess.txt b/htaccess.txt index 11bc142..0ccbd9f 100644 --- a/htaccess.txt +++ b/htaccess.txt @@ -4,7 +4,17 @@
Options -Indexes Options +FollowSymLinks -RewriteEngine On + +
+
// Tell PHP that the mod_rewrite module is ENABLED.
SetEnv HTTP_MOD_REWRITE On +
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
// The rest of your rewrite rules here
-----------------------------------------------------------------------------------------------
Access Restrictions: Keep web users out of ProcessWire system files
@@ -46,3 +56,9 @@ RewriteRule ^(.*)$ index.php?it=$1 [L,QSA]
END PROCESSWIRE HTACCESS DIRECTIVES
+ + +#RewriteEngine On + diff --git a/install.php b/install.php index 5b4d736..7c779e9 100644 --- a/install.php +++ b/install.php @@ -146,7 +146,17 @@ class Installer { if(in_array('mod_rewrite', apache_get_modules())) $this->li("Found Apache module: mod_rewrite"); else $this->err("Apache mod_rewrite does not appear to be installed and is required by ProcessWire."); } else {
$this->err("Unable to determine installed Apache modules. Please ensure you are running Apache, as it is currently required in order to run ProcessWire.");
//**
// Added to provide a check for mod_rewrite that works on my host.
// See the modifications to the .htaccess for other changes need to
// make this work.
//**
$mod_rewrite = getenv('HTTP_MOD_REWRITE')=='On' ? true : false ;
if ( $mod_rewrite ) {
$this->li("Found Apache module: mod_rewrite");
} else {
$this->err("Unable to determine installed Apache modules. Please ensure you are running Apache, as it is currently required in order to run ProcessWire.");