XF 2.1 Add warning to install documentation: "Requires rewrites be active in order to run install!"

bzcomputers

Well-known member
This has caught me twice now while installing XenForo for testing.

It is not unusual for admins to have .htaccess disabled by default and have rewrite rules configured in the main server configuration file for performance reasons. Currently, in the Installation manual there is no mention that "Installing" requires those rewrites to be active prior to install. It is also not what i would say typical (at least in my past experience) that a forum installation process would require this either.

With .htaccess disabled and the rewrites not configured elsewhere the install hangs at the database config screen. Every time you try to submit your database details the page just clears the details as if you refreshed the page. It produces no visible error, so re-entering the data seems to most appropriate thing - "thinking maybe I mistyped something". Then you are just stuck in the loop. So, I again sat this second time around trying to remember for the life of me what I did to get past this database setup page a few weeks ago. Then I spend time creating config.php manually - this gets me past the config setup but immediately hangs when trying to create tables. A few minutes later it comes to me, ahh the .htaccess rules! Then I copy the rewrite rules into the Apache config, reboot Apache and like magic I'm once again on my way. This time it only took me about an hour to do what should've taken 10 minutes.

I figured since this has caught me twice now, that I'm probably not the only one who has or will come across this issue.

I think a warning in the Installation manual and if possible produce an error on the config setup page (or add a warning here also) on the need for active rewrite rules would be helpful.
 
Not too sure what's going on in your particular case, but the installer shouldn't require rewrites to be active. Rewrites are only required for friendly URL support. I just tested performing a fresh installation using the built-in PHP development server (which has no support for rewrites) and was able to complete the installation just fine.
 
Well, it definitely was what caused my issue and the current .htaccess file in the install root does definitely reference the install directory on line 32.

Code:
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
 
Hmm, that rewrite rule should actually direct Apache not to apply other rewrite rules to URLs matching that pattern. In any event, I would imagine this is either a bug or down to some sort of Apache configuration issue outside of .htaccess (which .htaccess just happens to fix incidentally). Perhaps another rewrite rule you have configured somewhere is interfering, and thus the .htaccess rule instructs it not to? I'm not sure how to go about debugging that though, so maybe somebody else will know better.
 
Yeah, I do have a pretty large list of rewrite rules and i tried to find some conflict but nothing specifically stands out and most of my rules are limited in scope by specific directory.

Both times I ran into this issue just adding the .htaccess rules to the Apache config immediately fixed the problem and allow the install to continue. This is specifically what I added:

Code:
<Directory "/home/XXXX/public_html/community">
RewriteEngine On

#    If you are having problems with the rewrite rules, remove the "#" from the
#    line that begins "RewriteBase" below. You will also have to change the path
#    of the rewrite to reflect the path to your XenForo installation.
#RewriteBase /test-forum

#    This line may be needed to workaround HTTP Basic auth issues when using PHP as a CGI.
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</Directory>

I'd be interested to see if others can duplicate. I was very surprised not to find this issue already when searching this forum.

I'd be surprised if this was a one off issue specific to me but we'll see.
 
I'd be surprised if this was a one off issue specific to me but we'll see.
Get ready to be surprised, unfortunately.

By design, XF doesn’t require the .htaccess to be enabled for any part of the software.

We deliberately do not apply any rewrite rules to the install or admin apps because that would just be problematic if things go wrong.

Honestly the first time I recall seeing anything like this.
 
Honestly the first time I recall seeing anything like this.

Well, I'm definitely surprised. I guess there isn't much sense in trying to track down why it occurred in this instance then. Although my curious side says I'll probably try to track it down anyway.

Without the .htaccess, it just seems to break at the point where I submit the database configuration details to be written out to config.php. Which makes no sense to me looking at the rewrite rules.
 
Back
Top Bottom