Some mod_rewrite insight

Some mod_rewrite insight

am 12.04.2008 01:43:07 von Steve Finkelstein

Hi all,

Had a quick question with some rules that I'm having a bit of difficulty with.

Essentially I'm hosting a web application which follows the MVC design
pattern which relies on some mod_rewrite ninja in order to setup
proper internal routing. The base of the ruleset that gets the
application bootstrapped looks like the following:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Straightforward.

I'm trying to introduce an additional rule that maps the following:

http://foo.example.com that reads the following http://www.example.com/foo

Unfortunately the only difficulty with the above, is
http://www.example.com/foo is the URL that works after inheriting the
rules I stated above, as it needs to route through index.php. I've
tried something to this extent:

RewriteCond %{HTTP_HOST} ^foo\.example\.com$ [NC]
RewriteRule . /index.php/foo [L]

This is causing status 500, etc.

If anyone has any suggestions, or wants to see snippets from
rewrite.log, perhaps that can work. If you see a straight out error,
that would help me a lot.

Thanks all.

/sf

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Some mod_rewrite insight

am 14.04.2008 04:18:20 von Joshua Slive

On Fri, Apr 11, 2008 at 7:43 PM, Steve Finkelstein wrote:

> RewriteCond %{HTTP_HOST} ^foo\.example\.com$ [NC]
> RewriteRule . /index.php/foo [L]
>

I'm not sure why you have the leading slash on /index.php when you
don't seem to be using it in your main rule.

Other than that, error and rewrite log contents would be necessary to debug.

Joshua.

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org