.htaccess conflict with Wordpress in main folder

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Justin Wheeler
    New Member
    • Oct 2012
    • 14
    • 4.2.X

    .htaccess conflict with Wordpress in main folder

    Just bought and installed VBulletin Connect 5 Beta 16 and have been having some issues related to .htaccess and Wordpress.

    Hopefully someone might be able to help me.

    I have wordpress installed on my main domain and a forum installed in a subfolder.

    However the Wordpress .htaccess rules conflict with my .htaccess rules for vbulletin, as I am unable to access admincp unless I remove Wordpress' htaccess.

    Any suggestions would be much appreciated.

    HT access files are below:

    Wordpress:

    Code:
    # BEGIN WordPress<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    
    
    
    
    #----- START DAP -----
    RewriteCond %{REQUEST_FILENAME} -f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} (.*)/wp-content/uploads/(.*) 
    RewriteCond %{REQUEST_FILENAME} !(.*)(\.php|\.css|\.js|\.jpg|\.gif|\.png|\.txt|\.ico|\.jpeg)$ 
    RewriteRule (.*) /dap/client/website/dapclient.php?dapref=%{REQUEST_URI}&plug=wp&%{QUERY_STRING}  [L] 
    #----- END DAP -----
    
    
    </IfModule>
    
    
    # END WordPress
    VBulletin:

    Code:
    <IfModule mod_rewrite.c>RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?routestring=$1 [L,QSA]
    
    
    #needed because admincp is an actual directory.
    RewriteRule ^(admincp/)$ index.php?routestring=$1 [L,QSA]
    </IfModule>
  • Zachery
    Former vBulletin Support
    • Jul 2002
    • 59097

    #2
    Try changing your wordpress htaccess:

    Code:
    # BEGIN WordPress<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # if request is not for the /sub-dir/
    RewriteCond %{REQUEST_URI} !^[COLOR="#FF0000"]/sub-dir/[/COLOR] [NC]
    RewriteRule . /index.php [L]
    
    
    
    
    #----- START DAP -----
    RewriteCond %{REQUEST_FILENAME} -f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} (.*)/wp-content/uploads/(.*) 
    RewriteCond %{REQUEST_FILENAME} !(.*)(\.php|\.css|\.js|\.jpg|\.gif|\.png|\.txt|\.ico|\.jpeg)$ 
    # if request is not for the /sub-dir/
    RewriteCond %{REQUEST_URI} !^[COLOR="#FF0000"]/sub-dir/[/COLOR] [NC]
    RewriteRule (.*) /dap/client/website/dapclient.php?dapref=%{REQUEST_URI}&plug=wp&%{QUERY_STRING}  [L] 
    #----- END DAP -----
    
    
    </IfModule>
    Taken from here: http://stackoverflow.com/questions/9...htaccess-rules

    Try chaging sub-dir to the vbulletin folder name.

    Comment

    • Justin Wheeler
      New Member
      • Oct 2012
      • 14
      • 4.2.X

      #3
      Thanks.

      Unfortunately that didn't seem to make any difference.

      It's all rather frustrating....

      I can't really lose my .htaccess for wordpress, although at the moment it seems the only way I can get this to work.

      Comment

      • Zachery
        Former vBulletin Support
        • Jul 2002
        • 59097

        #4
        I'd suggest going to them about asking how to turn rewrites off for a specific subfolder.

        Comment

        • Justin Wheeler
          New Member
          • Oct 2012
          • 14
          • 4.2.X

          #5
          Thanks. For others who have a similar problem and having spent probably 12 hours in total trying to get this to work, the problem ended up being pretty simple!

          Adding in rewritebase /forum (change forum to your subdirectory) into the vbulletin htaccess seems to solve it, as per line 2 in the below vbulletin .htaccess..

          If any htaccess gurus happen to see this and think that is a very bad idea, please let me know. Otherwise i am happy as I can now actually start to use my forum!

          Code:
          RewriteEngine On
          RewriteBase /forum
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteRule ^(.*)$ index.php?routestring=$1 [L,QSA]
          
          
          #needed because admincp is an actual directory.
          RewriteRule ^(admincp/)$ index.php?routestring=$1 [L,QSA]
          Last edited by Justin Wheeler; Wed 31 Oct '12, 5:48am.

          Comment

          • Wayne Luke
            vBulletin Technical Support Lead
            • Aug 2000
            • 73981

            #6
            To have your parent directory ignore the forum directory you would add this to the .htaccess:

            RewriteRule ^forum/ - [L]

            Using RewriteBase can also resolve the issue because it resets the rewrite rules as far I am aware.

            Unfortunately adding this by default isn't possible either.
            Translations provided by Google.

            Wayne Luke
            The Rabid Badger - a vBulletin Cloud demonstration site.
            vBulletin 5 API

            Comment

            • Justin Wheeler
              New Member
              • Oct 2012
              • 14
              • 4.2.X

              #7
              Thanks Wayne, The RewriteRule was also one I tried on my way to get it working.

              The only one that did the job was the RewriteBase, so as long as it won't have any adverse effects I hope I will be okay!

              Comment

              • LNS
                New Member
                • Oct 2012
                • 1

                #8
                Worked beautifully for me! This was the first time I'd run into that particular combo -- WordPress in the root and vBulletin 5 in a directory -- and that one-line change was all I needed. I've had WordPress at the root of other forum sites but never vBulletin 5. Thanks for the very timely post!

                Comment

                • sojosojo
                  New Member
                  • Nov 2012
                  • 4
                  • 4.2.X

                  #9
                  Same problem. New to vBulletin. Fresh successful install of vB5 Beta 17. Forum loads fine, can't login to admincp (I see login screen, enter login data, blank page).

                  I read above and some other threads, have tried some things, but nothing is working.

                  Wordpress installed on ROOT / vB5 installed in subdir named FORUM.

                  I have .htaccess on root (which I modified like 'Justin Wheeler' did above) and I also have .htaccess in the 'forum' dir.

                  Server info:
                  Apache version 2.2.22
                  PHP version 5.2.17
                  MySQL version 5.5.23-55
                  Operating system linux
                  Perl version 5.8.8

                  Root htaccess:

                  Code:
                  # BEGIN WordPress
                  <IfModule mod_rewrite.c>
                  RewriteEngine On
                  RewriteBase /
                  RewriteRule ^index\.php$ - [L]
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteRule . /index.php [L]
                  </IfModule>
                  
                  # END WordPress
                  
                  
                   <IfModule mod_rewrite.c>
                  RewriteEngine On
                  RewriteBase /forum
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteRule ^(.*)$ index.php?routestring=$1 [L,QSA]
                  
                  #needed because admincp is an actual directory.
                  RewriteRule ^(admincp/)$ index.php?routestring=$1 [L,QSA]
                  </IfModule>
                  
                  # Use PHP 5.3
                  AddType application/x-httpd-php53 .php
                  'forum' subdir htaccess:

                  Code:
                  <IfModule mod_rewrite.c>
                  RewriteEngine On
                  RewriteBase /forum
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteRule ^(.*)$ index.php?routestring=$1 [L,QSA]
                  
                  #needed because admincp is an actual directory.
                  RewriteRule ^(admincp/)$ index.php?routestring=$1 [L,QSA]
                  </IfModule>
                  
                  # Use PHP 5.3
                  AddType application/x-httpd-php53 .php

                  Comment

                  • Wayne Luke
                    vBulletin Technical Support Lead
                    • Aug 2000
                    • 73981

                    #10
                    Change: RewriteBase /forum

                    To:
                    RewriteBase /forum/
                    Translations provided by Google.

                    Wayne Luke
                    The Rabid Badger - a vBulletin Cloud demonstration site.
                    vBulletin 5 API

                    Comment

                    • Justin Wheeler
                      New Member
                      • Oct 2012
                      • 14
                      • 4.2.X

                      #11
                      My guess is that you need to remove this part from the wordpress .htaccess and just have it in the forum .htaccess.

                      Not sure what the Use PHP 5.3 bit is and where that is needed, I didn't have it in mine so that may or may not need to remain in the wordpress .htaccess.

                      <IfModule mod_rewrite.c>
                      RewriteEngine On
                      RewriteBase /forum
                      RewriteCond %{REQUEST_FILENAME} !-f
                      RewriteCond %{REQUEST_FILENAME} !-d
                      RewriteRule ^(.*)$ index.php?routestring=$1 [L,QSA]

                      #needed because admincp is an actual directory.
                      RewriteRule ^(admincp/)$ index.php?routestring=$1 [L,QSA]
                      </IfModule>

                      Comment

                      • sojosojo
                        New Member
                        • Nov 2012
                        • 4
                        • 4.2.X

                        #12
                        Thanks guys, but I tried both suggestions and neither worked. I see this is a popular topic - is anything being done to prevent/correct it in an update? (again, new to vBulletin all together so I'm not sure how updates and things work).

                        Comment

                        • Justin Wheeler
                          New Member
                          • Oct 2012
                          • 14
                          • 4.2.X

                          #13
                          What are your two .htaccess files now?

                          And stupid question but the forum is actually in a subfolder called forum isn't it?

                          Comment

                          • sojosojo
                            New Member
                            • Nov 2012
                            • 4
                            • 4.2.X

                            #14
                            WP on root:

                            Code:
                            # BEGIN WordPress
                            <IfModule mod_rewrite.c>
                            RewriteEngine On
                            RewriteBase /
                            RewriteRule ^index\.php$ - [L]
                            RewriteCond %{REQUEST_FILENAME} !-f
                            RewriteCond %{REQUEST_FILENAME} !-d
                            RewriteRule . /index.php [L]
                            </IfModule>
                            
                            # END WordPress
                            
                            
                            
                            # Use PHP 5.3
                            AddType application/x-httpd-php53 .php
                            Forum (yes, it's in a subdir named 'forum'

                            Code:
                            <IfModule mod_rewrite.c>
                            RewriteEngine On
                            RewriteBase /forum/
                            RewriteCond %{REQUEST_FILENAME} !-f
                            RewriteCond %{REQUEST_FILENAME} !-d
                            RewriteRule ^(.*)$ index.php?routestring=$1 [L,QSA]
                            
                            #needed because admincp is an actual directory.
                            RewriteRule ^(admincp/)$ index.php?routestring=$1 [L,QSA]
                            </IfModule>

                            Comment

                            • sojosojo
                              New Member
                              • Nov 2012
                              • 4
                              • 4.2.X

                              #15
                              bump

                              Comment

                              Related Topics

                              Collapse

                              Working...