rewrite rule for two folders

303 views Asked by At

I'm migrating my web from Joomla to WordPress, in order to do so I need to set up access to a new subfolder to install WordPress.

I have a .htaccess file redirecting actual Joomla app to subdirectory /joomla/. I need access to /wp/ to set up and test before deleting /joomla/ directory. Actual .htaccess is:

<Files php.ini>
  order allow,deny
  deny from all
</Files>

rewritecond %{http_host} ^myweb.info
rewriterule ^(.*)$ http://www.myweb.info/$1 [r=301,nc]
Options FollowSymLinks
RewriteEngine On

# www.myweb.info joomla hack
# Add missing trailing slashes.
RewriteCond %{HTTP_HOST} ^(www\.)?www.myweb\.info$ [NC]
RewriteCond %{DOCUMENT_ROOT}/joomla%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

# Domain to sub directory.
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?www.myweb\.info$ [NC]
RewriteRule ^(.*)$ /joomla/$1 [QSA,L]

#No Directory Listing and Browsing
IndexIgnore */*
Options All -Indexes
# End deny directory listing

Guess I have to remove or change IndexIgnore but also allow /wp/ access, may you give me a hand on this?

Hosting at GoDaddy, virtual server is Linux.

2

There are 2 answers

2
TALLBOY On

This will ignore your /wp/ subdirectory on the server. That way you can install Wordpress in that directory, test, and deploy without killing your Joomla install.

 RewriteRule ^wp/.*$ - [PT]
1
Gumbo On

Alter your one rule as follows:

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?www.myweb\.info$ [NC]
RewriteCond $1 !^wp/
RewriteRule ^(.*)$ /joomla/$1 [QSA,L]