문제

I've used FatFree quite a lot recently on Ubuntu, and have had no problems putting it into subdirectories. However, I recently tried to do this in a user website on Mac (10.6.8) and ran into the problem of needing a RewriteBase for the routing to work.

I was wondering if anyone has any idea why the default Apache setup on Ubuntu seems to allow the routing to work without a RewriteBase in the .htaccess, but the setup on Mac makes it necessary.

The Ubuntu setup uses a bunch of VirtualHosts, whereas the Mac config just has a server config, mod_userdir enabled and a directive for each user's Sites directory.

도움이 되었습니까?

해결책

The mod_rewrite documentation says that the RewriteBase directive is required unless either of the following conditions are true:

  • The original request, and the substitution, are underneath the DocumentRoot (as opposed to reachable by other means, such as Alias).
  • The filesystem path to the directory containing the RewriteRule, suffixed by the relative substitution is also valid as a URL path on the server (this is rare).

The first condition is probably met with your Ubuntu setup but not with your Mac setup, since you are using mod_userdir. If you move your files from ~/Sites to the DocumentRoot (default on Mac is /Library/Webserver/Documents), chances are that you won't need the RewriteBase anymore.

다른 팁

I'm not sure, but i can tell you that most apache setups have RewriteBase / as default value, which makes it superfluous to write it in your .htaccess file once more, if your F3 is on webroot. Maybe this portion is missing in a MAMP setup on mac.

Running F3 in a subdir of the virtualhost or webroot usually always requires a valid definition of RewriteBase.

Additional information about this can be found here:

https://github.com/bcosca/fatfree/wiki/FAQ#can-i-run-f3-in-a-sub-directory

Let me just explain how you should analyze the difference between the Mac and Ubuntu configurations so you can understand why RewriteBase is required by one but not the other. Add this to your Apache config:

RewriteLog /var/log/apache2/error.log
RewriteLogLevel 9
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top