Project

General

Profile

mod_rewrite and alias directives

Added by Dillan Laughlin over 14 years ago

I have successfully setup Redmine using fcgi on a domain that must be shared with another script. The other script will be hosted from a "subdirectory" within my public folder. The problem is that this other script doesn't physically reside inside this subdirectory. Instead I believe my webhost is using Alias directives that seem to be have issue with the way mod_rewrite is configured.

In the .htaccess file I noticed this...

# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
#   RewriteCond %{REQUEST_URI} ^/notrails.*
#   RewriteRule .* - [L]

But that only works for files that actually reside in the folder, not aliased ones like I'm dealing with.

Otherwise my the rewrite portion of my .htaccess looks something like this...

RewriteEngine On

RewriteCond %{REQUEST_URI} ^/subdirectory.*
RewriteRule .* - [L]

RewriteRule ^$ index.html [QSA]                          
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

Playing with the .htaccess file I have been able to get one or the other working but never both at the same time. This may be a simple issue for some but I think it would be great to get a solution here in the forums for others that might also have this issue.

Here is my configuration:
Ruby version 1.8.7 (x86_64-linux)
RubyGems version 1.3.5
Rails version 2.1.2
Active Record version 2.1.2
Action Pack version 2.1.2
Active Resource version 2.1.2
Action Mailer version 2.1.2
Active Support version 2.1.2
Application root /home/user/mydomain.com
Environment production
Database adapter mysql
Database schema version 101