You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Steve Finkelstein <sf...@stevefink.net> on 2008/04/12 01:43:07 UTC

[users@httpd] Some mod_rewrite insight

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 <URL:http://httpd.apache.org/userslist.html> 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: [users@httpd] Some mod_rewrite insight

Posted by Joshua Slive <jo...@slive.ca>.
On Fri, Apr 11, 2008 at 7:43 PM, Steve Finkelstein <sf...@stevefink.net> 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 <URL:http://httpd.apache.org/userslist.html> 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