Using Wordpress in a subdirectory

Brent W

Well-known member
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?
 
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/
 
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?
 
I assume Wordpress has its own .htaccess file in /wordpress? Try setting an appropriate RewriteBase in there.

RewriteBase /wordpress
 
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
 
Fixed. This is your WP .htaccess file now:

Rich (BB 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.
 
Fixed. This is your WP .htaccess file now:

Rich (BB 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 :)
 
Top Bottom