Zend Controller Name Case Sensitivity - apache

I'm using the Zend Framework to develop an application on a linux host, and for some reason when I try to go to localhost/index it gives me what looks like a standard Apache 404 error. But when I go to localhost/Index it works. I can also go to localhost/admin and it will work with no problem. For some reason it seems that my index controller doesn't want to work. How can I make it to where localhost/index works?
My .htaccess file seems fine and has the correct rewrite rules in it.

I had a similar problem and tracked it back to Options MultiViews on Apache. If you're using a vhost, check there. If I recall, MultiViews will try to find other files with a similar name if the requested file is not found. If it's on, try disabling it and see what happens.

Related

How to do URL rewriting in Apache through Chef?

I've made a cookbook in Chef to install a web application, Apache and PHP.
This web application has a PHP document that clients access in this URL:
http://localhost/www-app/ClientFE
With this I have a problem. By default PHP will only interpret documents that have a PHP extension, and as my URL doesn't have it, it gets interpreted as text. I can't change the file's extension because the client (which is also software) should not be modified.
What I want to accomplish is to make PHP interpret that document, and for what I've investigated it can be accomplished in three ways at least: configure appropriately PHP, create an alias, create a rewrite rule.
First: I could configure PHP to interpret the desired document:
<FilesMatch "/www-app/ClientFE">
SetHandler application/x-httpd-php
</FilesMatch>
Second: I could do it through mod_write (I would have to rename the fill in the web app, which is also acceptable for me):
RewriteCond ^/www-app/ClientFE /www-app/ClientFE.php
Third: I could do it with mod_alias in a similar fashion than mod_rewrite.
The 3 are good for me, but my problem is: how to do them with Chef ? I haven't been able to find useful docs about it, and I have already tried to put this in my recipe (I found them around the Internet but they haven't worked):
apache_rewrite do
source "/www-app/ClientFE"
target "/www-app/ClientFE.php"
end
and this
apache_module "alias" do
source "/www-app/ClientFE"
target "/www-app/ClientFE.php"
end
Some people in my company suggested 2 valid solutions:
Put the configuration in a .htaccess inside my web application. This works for me and allows to use the alternatives I mentioned above.
Do nothing! It happens that the Multiviews option in the Apache2 cookbook is enabled by default, and it allows Apache to resolve URL http://localhost/A as http://localhost/A.php .... I mean, if Apache is asked about file A, and it doesn't find it, then it will search for A.php instead.
From the two, I chose the later, and yes, it works. It wasn't working before because in my many attempts I created both A and A.php and in that case the Multiviews has no effect.

FollowSymLinks error "Not allowed here"

I've been searching for 4 hours already but I can't seem to find a solution to our problem.
The problem we've encountered
We have a CentOS Linux 6.4 server, running Virtualmin 3.99.gpl. We have a Drupal website which we would like to move to this server, and as it's a multidomain site, we will have to use FollowSymLinks. This has (as I was told) been disabled as some security flaws were discovered addressing this directive. Since then you would have to use SymLinksIfOwnerMatch. Now, Drupal has a lot of .htaccess files hidden deep in the roots of this system, and as I'm not sure how this new method will be supported, I wanted to ask some experts their opinion to the solution my colleague proposed.
The Proposed solution
My colleague told me that it would probably work if I'd wrote a simple shell script to edit all the .htaccess files in the root folder of the domain, which would replace all the FollowSymlinks with the SymLinksIfOwnerMatch. As I'm not sure if this would fix this problem, I would like to ask your opinion on this.
What we've tried
We've tried to fix the configuration file from Apache to allow FollowSymLinks, but this did not work. Also we tried changing the global configuration in Webmin, but webmin ignored these edits (a fix for this would be great!). Deleting the line of the .htaccess in the root folder, fixes the problem, but this is not the solution we want to use.
Any other solutions, fixes or workarounds?
Just to come back at this, the proposed solution 'just works' in my case.

Apache - disabling automatic rewrite

I'm just beginning to test my usage of mod_rewrite on a local apache setup.
While rewrite rules are working fine, my problem is that a page like "localhost/foo/" is automatically redirected to "localhost/foo.php". This happens even with no rewrite rules. Is this normal? I assume not, since this does not happen on my hosted domain. How can I disable this?
Figured out what the problem was - documenting it as an answer for future searchers [is this the correct procedure?]
I had to disable MultiViews - it was redirecting localhost/foo to localhost/foo.php if it could find that file. Everything worked just fine once that was done.
Some sort of rewrite is going on. You could rename the actual module on disk to make sure its not used. In Linux it is /usr/lib/httpd/modules/mod_rewrite.so

mod_rewrite not working?

So I'm trying to get mod_rewrite to work, using Apache2.2 on windows 7
I'm running it as a local server.
All sites are accessed at http://localhost/
It's not working?
I created a simple .htaccess file and it won't work.
in the httpd.conf I changed it to
Options All
AllowOverride ALL
Whats the problem?
Try writing garbage in your .htaccess file. This should cause a 5xx error message. If it does not then your AllowOverride All is at the wrong place in your config.
I would also suggest adding a (name based) virtualhost to keep your configuration at one place instead of modifying the defaults.
Just want to add to the above which is correct, I was also pulling my hair on a non-working .htaccess. After hours of testing and troubleshooting it turned out that, even though my Sublime Text 2 was set to UTF-8, somehow it was still carrying over hidden special characters that were the root cause of my problem. After copying & pasting .htaccess' contents into vim editor, removing those weird characters, then resaving things started working as should.

Weird apache behavior when trying to display urls without html extension

I have a url that is easily accessible when you request it as:
http://example.com/2005/01/example.html
or
http://example.com/2005/01/example
(I actually don't know why it works without the extension. Instead, it should return the usual 404 error.)
However, when I try to access the following url:
http://example.com/2005/01/example/
(note the trailing slash)
I get a 404 Not found error but with the requested url printed as:
http://example.com/2005/01/example.html/
So, it seems the ".html" part was automatically added by apache.
My question is: how do I disable this behavior? I need to do it because I want add mod_rewrite rules to hide the html extension, so that I can access that url as:
http://example.com/2005/01/example/
My apache is 2.2.9 on Ubuntu 8.10.
Thanks!
MultiViews could cause this behavior. Try to disable it:
Options -MultiViews
Is example.html an actual file that lies in the directory path 2005/01? It seems like mod_rewrite is already active. If you use a blog or content management system on your server, then it probably does stuff to your url's already.