On Friday 16 January 2009 05:36:18 Anthony M Simonelli wrote:
I've configured Apache, but it seems that the AllowOverride directive,
set to "All", causes my Apache2 to only serve up Access Forbidden. Is
there a reason for this? Changing it back to "None" displays the pages
but ignores .htaccess files. I have a PHP framework that uses header
rewrites so I'd like to get that functionality working.
--
Anthony M Simonelli
I'd suggest checking your logs (/var/log/apache2) to see what caused the
offending 403. And in case you have not enabled it already you'll need
"Options FollowSymlinks" directive in your <directory> section ( or your
.htaccess), mod_rewrite requires this.
A typical basic vhost to get a quick development app up and running with a
fremework that uses url rewriting (Zend Framework for example) might look
something like this.
DocumentRoot /srv/www/htdocs/mysite/public
ServerName pastebin
ServerAdmin root@localhost
AllowOverride All
Order allow,deny
Allow from all
Options FollowSymlinks
</Directory>
</VirtualHost>
Here is a sample directory structure in /srv/www/htdocs/mysite for a framework
site using mod_rewrite
mysite
public
.htaccess
index.php
application
bootstrap.php
library
Zend
and then a basic .htaccess
# Redirect options
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]
</IfModule>
This .htaccess does the following, checks the following conditions
The requested URL points to a resource that is an existing file (-s), symbolic
link (-l) or a directory (-d). So basically if a client browser is asking for
http:://mysite.com/images/image.jpg and image.jpg exists it will serve it. If
not it will perform a local, case insensitive redirect to index.php.
index.php typically would be where you either launch a bootstrap or directly
try and dispatch from the frameworks front controller class/object.
To launch your application from a bootstrap index.php simply needs one line.
dispatch();
Regards
Graham
--
To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse+help@opensuse.org