XF 1.4 Can't enable mod_rewrite in apache on CentOS

anony372929

Member
Hey guys. Normally I don't have issues at all enabling mod_rewrite in Apache on my CentOS server, but this time I just can't seem to get it to work. I am trying to enable it for my newly purchased Xenforo license.

Here's my .htaccess in /var/www/html
HTML:
 #    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
<IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>
    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 mumausprison.com/

    #    This line may be needed to enable WebDAV editing with 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]
</IfModule>

and here is my apache conf.d file in /etc/httpd/conf/httpd.conf
http://pastebin.com/998PDW98

(Used pastebin because it'd take up too much space in here, haha)
 
It's usually an AllowOverride issue. I see an area that appears to try to change it, but it's also using these weird smart quotes so it may not be doing what you expect (and I also don't know if that's where your web root is).
 
If you have access to the sites configuration file, it would be best to list the rewrite and other overrides you would normally put into the .htaccess in the vhost file.
If you cannot do that for some reason, make sure to modify the AllowOverrides setting as Mike pointed out in the httpd.conf / vhosts file(s). You would want to set your specific requirements, but if you are unsure of those you can just do

Code:
AllowOverride All

Not really recommended but do-able.

Edit, as a quick note your rewrite base should read
Code:
RewriteBase /

Or
Code:
RewriteBase /folder/xf/sits/in/

You would not put your domain in front of the /
 
Last edited:
It's usually an AllowOverride issue. I see an area that appears to try to change it, but it's also using these weird smart quotes so it may not be doing what you expect (and I also don't know if that's where your web root is).
Hey @Mike I tried changing the quotes to normal ones, strange enough, when I change it to the correct quotes I get 500 internal server error. Also, the web root is /var/www/html.
 
You can probably just take out the quotes (see starting from line 302).
Tried removing quotes from
Code:
<Directory “/var/www/html“>
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
in the apache config, got 500 internal server error. Appears only those weird quotes are working :/

Anybody know a fix?
 
Back
Top Bottom