mod_rewrite two subdirectories to root index.php, everything else to index.html

Hi experts,

I have a drupal multisite set up with two subdirs (as symbolic links) and drupal running in the root dir. I need to modify the .htaccess file so that requests to the subdirs go to the index.php file (standard drupal behaviour) but any request outside of those subdirs go to index.html

Any suggestions? attached is the relevant section from the drupal default .htaccess file
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

Open in new window

LVL 10
mstrelanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

proadminCommented:
Seems like you need a {HTTP_HOST} condition if you want to catch subdomains.

I suggest you do it this way.

^subdomain\.maindomain\.com$
0
mstrelanAuthor Commented:
Sorry I was specifically after a subdirectory, not a subdomain.
0
Michael WorshamStaff Infrastructure ArchitectCommented:
As an example, if you have say a 'testing' subdirectory, which index.php file do you want it to access?

/testing/index.php

_or_

/index.php

0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

mstrelanAuthor Commented:
/index.php
0
Michael WorshamStaff Infrastructure ArchitectCommented:
See if this is what you are looking for...




<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^/first-directory-to-change/(.*)$ /index.php [R=301,L]
  RewriteRule ^/second-directory-to-change/(.*)$ /index.php [R=301,L]
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

Open in new window

0
mstrelanAuthor Commented:
No anything outside of the subdirs has to go to .html not .php. I think if I changed the last line above to .html then the 301s would redirect to index.php which would then redirect to index.html. I don't think it's possible.

My requirements have changed now and I don't need this any more. I will accept this comment and award you points for assisting.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.