Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Wordpress integration

0 votes
474 views
asked Nov 10, 2013 in Q2A Core by codecowboy
edited Nov 10, 2013 by codecowboy

I have a local wordpress install at local.mysite (OSX Mountain Lion with my own Apache, not MAMP etc)

In the root directory for local.mysite I have sub directories /Wordpress and /question2answer.

Wordpress is installed and working at http://local.mysite and I have followed the wordpress integration instructions. If I navigate to local.mysite/question2answer in order to install q2a I get a 404 error page styled as a Wordpress page and am not directed to the installer for q2a

What have I missed? Wordpress version is 3.7

Q2A .htaccess :

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>

.htaccess for 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>

It seems to me that .htaccess rules would need to be changed for this setup but there is no mention of this in the wordpress integration guide.

Q2A version: 1.6.2

1 Answer

0 votes
answered Nov 10, 2013 by monty&bex

My own setup has Wordpress in the root directory with Question 2 Answer in a subdirectory q2a.

My wordpress htaccess file is:

# 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
# compress text, html, javascript, css, xml:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddType x-font/otf .otf
AddType x-font/ttf .ttf
AddType x-font/eot .eot
AddType x-font/woff .woff
AddType image/x-icon .ico
AddType image/png .png
</IfModule>

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##

 

My q2a htaccess file is



DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>

 

I used a simple php file in the root wordpress installation

 

<?php
$dir = dirname(__FILE__);
echo "<p>Full path to this dir: " . $dir . "</p>";
?>

 

to find the correct path for XXX in qa-config.php



define('QA_WORDPRESS_INTEGRATE_PATH', 'XXX');

 

Hope this helps.  Best of luck

 

Monty and Bex

 

commented Nov 10, 2013 by codecowboy
Thanks but the question relates to a folder structure with Wordpress and question2answer at the same folder level i.e the question2answer folder is NOT inside the root Wordpress install folder ('/Wordpress')
...