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

Using Wordpress in a subdirectory

Brent W

Well-known member
#1
I have a site that has xenForo in the root and will have wordpress in a subdirectory (domain/wordpress/ for example)

However, when I use permalinks in wordpress xenForo tries to handle them. How do I get around this?
 

Brent W

Well-known member
#3
Not working still

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.shottalk\.com
RewriteRule (.*) http://www.shottalk.com/$1 [L,R=301]
RewriteRule ^store - [L]
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]


You can try it here: http://www.shottalk.com/store/
 

Slavik

XenForo moderator
Staff member
#4
Hmm, maybe something like

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} "/store/
RewriteRule (.*) $1 [L]
RewriteCond %{HTTP_HOST} !^www\.shottalk\.com
RewriteRule (.*) http://www.shottalk.com/$1 [L,R=301]
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]


instead?
 

Jake Bunce

XenForo moderator
Staff member
#8
I assume Wordpress has its own .htaccess file in /wordpress? Try setting an appropriate RewriteBase in there.

RewriteBase /wordpress
 

Brent W

Well-known member
#9
Already have the base in there

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /store/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
 

Jake Bunce

XenForo moderator
Staff member
#15
Fixed. This is your WP .htaccess file now:

Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /store
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [L]
</IfModule>
# END WordPress
I removed the ending / from the RewriteBase, and I changed the last RewriteRule which had two problems.

1) The URI match was just . which would only match one character, so I changed it to ^.*$ which will match any URI, just like XenForo's .htaccess file.

2) I removed the beginning / from the target location so it's just index.php instead of /index.php. One is relative, the other is not.
 

Brent W

Well-known member
#16
Fixed. This is your WP .htaccess file now:

Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /store
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [L]
</IfModule>
# END WordPress
I removed the ending / from the RewriteBase, and I changed the last RewriteRule which had two problems.

1) The URI match was just . which would only match one character, so I changed it to ^.*$ which will match any URI, just like XenForo's .htaccess file.

2) I removed the beginning / from the target location so it's just index.php instead of /index.php. One is relative, the other is not.
Thanks :)