1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.1 .htaccess taking over Mediawiki

Discussion in 'Troubleshooting and Problems' started by Brentnauer, Oct 14, 2011.

  1. Brentnauer

    Brentnauer Well-Known Member

  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Edit your XenForo .htaccess file and add the red code:

    Code:
    	RewriteCond %{REQUEST_FILENAME} -f [OR]
    	RewriteCond %{REQUEST_FILENAME} -l [OR]
    	RewriteCond %{REQUEST_FILENAME} -d
    	RewriteRule ^.*$ - [NC,L]
    	RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|w/) - [NC,L]
    	RewriteRule ^.*$ index.php [NC,L]
    
    That should exclude your "w" directory.
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Well wait. If the directory exists then it should already not be handled by XenForo. I have tested and confirmed this.
     
  4. Brentnauer

    Brentnauer Well-Known Member

    Right, the /w directory exists but is being rewritten to /wiki (which does not exist, it's a virtual directory) per the instructions in the link in the first post.

    I added wiki/ to my htaccess like in your example above and it gives me this: http://minegasm.net/wiki/Main_Page
     
  5. Brentnauer

    Brentnauer Well-Known Member

    Here are the current contents of my .htaccess. Mediawiki's bit is at the bottom:
    Code:
    #    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 500 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 /xenforo
    
        #    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|wiki/) - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
    </IfModule>
    
    RewriteEngine On
    RewriteRule ^/?wiki(/.*)?$ /w/index.php [PT,L,QSA]
    RewriteRule ^/*$ /w/index.php [L,QSA]
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You should probably exclude w/ and wiki/ to be safe. Though I don't think it's necessary.

    Then you need to add the rewrite rules for the wiki to the htaccess file. Add those rules before XenForo's rules. I am feelin this:

    Code:
    #    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 500 default
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        RewriteRule ^/?wiki(/.*)?$ /w/index.php [PT,L,QSA]
        RewriteRule ^/*$ /w/index.php [L,QSA]
    
        #    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 /xenforo
    
        #    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|wiki/|w/) - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
    </IfModule>
    
    I am not immediately sure what the purpose of the blue line is. I might be inclined to get rid of that.
     
  7. Brentnauer

    Brentnauer Well-Known Member

    No dice, both with and without the blue line :( Also causes xF to grab the page again instead of the 404 I was getting with the one I posted above.

    This one has me stumped, I greatly appreciate your help so far :)

    If you're willing to take a crack at it I can PM you some FTP credentials.
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Sure. Send me FTP.
     
  9. Brentnauer

    Brentnauer Well-Known Member

    Jake is a damn genius. Not three minutes after he got FTP info he fixed it... Been cracking my skull over this for five hours now. Here's what we ended up with, in case anyone has a problem like this in the future:
    Code:
    #    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 500 default
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        RewriteRule ^/?wiki(/.*)?$ /w/index.php [PT,L,QSA]
        RewriteRule ^/*$ /w/index.php [L,QSA]
    
        #    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 /xenforo
    
        #    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|wiki/|w/) - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
    </IfModule>
    Thanks again, Jake!
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Code:
    RewriteRule ^/*$ /w/index.php [L,QSA]
    
    I didn't use that line to get it working. In fact that line interfered with XenForo.

    I only added this line to the default XenForo htaccess file:

    Code:
    RewriteRule ^/?wiki(/.*)?$ /w/index.php [PT,L,QSA]
    
     

Share This Page