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?
 
mstrelanConnect With a Mentor Author 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
 
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Michael WorshamInfrastructure / Solutions 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
 
mstrelanAuthor Commented:
/index.php
0
 
Michael WorshamConnect With a Mentor Infrastructure / Solutions 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
All Courses

From novice to tech pro — start learning today.