Why does fatfree need a RewriteBase on Mac but not Ubuntu? - macos

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

Related

Change localhost/htdocs folder in Xampp 8.2

I know this is not a new question but I think something has changed with Xampp in the latest version. I was using Xampp 8.0 and was using another directory to serve as localhost just fine. My Xampp installation is in C:/xampp while my projects are located in D:\Whip\Projects. This is the folder I want to load when using the address localhost.
I changed 2 lines in httpd.conf like I had done several times before
DocumentRoot "D:\Whip\Projects"
<Directory "D:\Whip\Projects">
The folder loads but PHP doesn't work properly. I get errors related to missing session folders and extensions. The problem is in php.ini file the paths are not absolute anymore. For example, in xampp 8.0 I had
session.save_path="C:\xampp\tmp"
In 8.2 I have
session.save_path="\xampp\tmp"
And same thing with extensions directory and all other paths defined in php.ini (and who knows where else). If I manually add C: to the path above, the sessions start working. I'm apprehensive of changing every path like that. Is there a better way to change the htdocs folder now?

URL issue in XAMPP Windows

I am facing a problem with a project recently. The site is running locally fine. Like if I browse the site its showing me the page also if I do some thing like "localsite.dev/students" it is also showing the page. But if I type "localsite.dev/students:auth", I am getting "Access forbidden!". I am using XAMPP in Windows 8. Here is my configuration:
Apache Version Apache/2.4.10 (Win32) OpenSSL/1.0.1t PHP/5.6.24
PHP Version 5.6.24
Is it a problem with the .htaccess file or any Apache settings problem. Please let me know. The .htaccess file that I am using is like following:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Please help me. I have already spent a lot of time with it. Thanks in advance for any kind of help.
Apache runs as the "nobody" user by default, it might have permission to browse your [OSX/Win] user directory or some of its subdirectories.So, you will receive "access forbidden" error when you try and view your development site. Another scenario will be that you might find that you are able to view your dev site, but PHP throws errors when you attempt to write files or make directories on the filesystem.
So, to fix this you can configure Apache to run as your [OSX/Win] user. Open httpd.conf and look for following lines:
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User nobody
Group nogroup
Change this to:
User Username01
Restart Apache and you are now good to go to navigate your site without any issues, including manipulating files and folders using PHP.
Refer the link for reference:
Virtual Hosts in xampp
Hope It helps you.

"DocumentRoot must be a directory" error in Apache on Windows XP

I try to setup Apache (part of EnterpriseDB ApachePHP package) for localhost. But Apache won't start since the first restart (after initial configuration). Httpd.exe complains that "DocumentRoot must be a directory" - but it IS a directory, and Apache even recognized it as such before the first restart. This problem persists even when I change the DocumentRoot back to its default directory.
The problematic line looks like this: DocumentRoot "d:\www\" When changing the backslashes to slashes or deleting the trailing backslash httpd.exe works forever and never reaches any result, so I understand that this is the correct format.
There is a good question on this: Apache restart causes DocumentRoot must be a directory, even though it is a directory and there seem to be no privilege issues. Unfortunately, I believe its solution is not applicable to my case: on Windows XP (32 bit) there is no SELinux to disable.
The last action I did before the restart was enabling (uncommenting) php_gd2 library in php.ini. Reverting this didn't make Apache work, so I guess this is not the reason. This (and the root directory in httpd.conf) was the only change I did, otherwise I accepted EDB's defaults.
Any ideas what to do now?
I have reinstalled EnterpriseDB Apache PHP and now it seems to work fine. The correct format is with no trailing slash - under this configuration server is running now, and when I execute httpd.exe in command line, it shows some log in less than a minute (not "still working after an hour"). I don't know what caused the problem, but it is solved.

install wordpress locally on OS X without MAMP (permission error)

I'm trying to install wordpress locally on a mac with the built in stuff (apache/php) without installing MAMP. basically I'm following this tutorial:
https://gist.github.com/1500117
after editing the httpd.conf file, and restarting apache, I get this error in the browser:
Forbidden
You don't have permission to access / on this server.
Any ideas?
I'm using Snow Leopard
well it seams I found what caused the problem.
the Sites folder, where I put the wordpress folder had permissions 750, after changing it to 751, now it works.
is this a proper solution or I should keep digging?
While there are a lot of variables to check here, the two biggest are the server root (make sure the case of all the path elements is correct) and the user permissions/owner of the WordPress files themselves.
All that said, why not use MAMP for this kind of situation?
Try typing http://your-host-name/index.php
If that fixes it, then your DirectoryIndex directive (in httpd.conf) needs to be changed to DirectoryIndex index.html index.php
If that does not fix it, type tail -f /var/log/apache2/error_log at the console and look at the terminal screen while you hit http://your-host-name/index.php in your browser. It may tell you what the problem is. If not, paste the last few lines of the log file up here and I'll look at it for you.

OS X Lion Server - Apache Question - index.html.en

I've added some additional sites to my apache config today, however the default document root should serve the "It Works" index.html.en apache default page. However I must of altered something by accident as it now displays the directory listing by default instead? If I navigate to index.html.en it successfully loads, but not by default when I enter 127.0.0.1 for example.
I'm sure the .en language files are resolved by httpd-languages.conf, I have doubled checked that files dependancies are included in httpd.conf 'mod_mime' & 'mod_negotiation'.
The problem shouldn't bother me to much but I would like to discover the cause if possible?
Specify your DirectoryIndex by putting:
DirectoryIndex index.html.en
in httpd.conf or .htaccess files.

Resources