.htaccess "stuck" in xammp - Mac OSX - .htaccess

I have a number of local sites set up with XAMMP. They all work fine except one. They all have identical configuration in httpd-vhosts.conf:
<VirtualHost *:80>
ServerName aheadlocal
DocumentRoot "/Users/myname/Sites/aheadlocal/"
<Directory "/Users/myname/Sites/aheadlocal/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
While downloading the latest version from the dev server, I accidentally downloaded an .htaccess file that was redirecting certain directories to the live site.
I deleted the .htaccess file, flushed DNS, stopped and restarted Apache and even shut down and rebooted my computer.
Yet I am still being redirected, just on certain directories. There are no other .htaccess files in those directories and no other redirects in the files. I even have caching turned off in httpd.conf
This is not drupal or wordpress - I'm not using a database. It's just php/javascript and Foundation 4.
I'm stumped. Any ideas?

Switched to MAMP and that fixed the problem.

Related

mod_rewrite is enabled, .htaccess file is ok, but requests are not going through index.php

I've just installed ubuntu-server_6.04.2_LTS, after the fresh installation I've enabled mod_rewrite, it's showing in phpinfo()
my .htaccess file is OK
but, still requests are not going through index.php
You should check if for that specific directory (root folder of your project), apache is configured to allow overriding through .htaccess.
If you want to allow such override, the directives found in apache.conf or the specific settings for your virtual host should look like this:
<Directory /var/www/>
AllowOverride All
Require all granted
</Directory>

Apache 2 default document root won't change (Ubuntu)

I want to prevent direct access to the server web root showing the Ubuntu home page at /var/www/html/index.html
I have changed the following:
/etc/apache2/sites-available/000-default.conf
DocumentRoot /var/www/websites
And restarted Apache but it's still going to /var/www/html if I visit my server directly.
Edit:
It appears this problem is only when I access the server on HTTPS. On HTTP it works fine.
You also need to change in /etc/apache2/apache2.conf. Find this:
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
and change to your desired directory

Multiple VirtualHosts for Rails sites

I would like to run a rails app under a subdirectory on my Linux VPS, and having trawled the passenger documentation I am unsure as to how to set up the proper virtualhost config and symlinks for my machine.
I have a domain called www.domain.eu and a rails app located at /apps/webapp, and i would like the site to be hosted at www.domain.eu/webapp
Im am unsure of a few areas:
1.) Where should i enter the webapp VirtualHost config details? should it be in the apache2.conf file or should create a file in sites-available called webapp and put the config in there? There seems to be many conflicting examples.
2.) Learning from the previous question, how could I amend this apache2.conf file to serve up the rails app under the directory www.domain.eu/webapp (again read through lots of docs, but there seems to be many ways of doing this)
<VirtualHost *:80>
ServerName domain.eu
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /apps/webapp/public
<Directory /apps/webapp/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
RailsBaseURI /webapp
<Directory /apps/webapp/public>
Options -MultiViews
</Directory>
</VirtualHost>
3.) I realise that a symlink needs to be created to point the directory root to the url. Having tried ln -s /apps/webapp/public ./test it comes back with a missing symlink error. What would be recommended here?
4.) Lastly, rails 3 config.action_controller.relative_url_root = "/webapp" appears to be deprecated, is there a new recommended convention to use?
my setup: Linux VPS server running Ubuntu 10.04, mysql 5, apache2, phusion passenger (latest), ruby 1.9.3 and rails 3.2.3.
If anyone needs more code just shout, thanks in advance!
So after much reading I managed to get this working.
For my purpose I added in the VirtualHost info for a sub URI site into the bottom my apache2.conf file, it may be httpd.conf for you, but you can enter these into /etc/apache2/sites-available if you wish to keep it all seperate.
At the top of this file I specify where the default "homepage" for the server is. I am running apache2 so my homepage is located at /var/www. Below this we set our rails Sub URI options, so firstly specify what URL you would like as your sub URI, then point the directory tag to the public folder of your rails app. MultiViews must be off hence the (-) so our apache2.conf file is complete.
<VirtualHost *:80>
ServerName domain.com
DocumentRoot /var/www
<Directory /var/www>
Allow from all
</Directory>
RailsBaseURI /webapp
<Directory /apps/webapp/public>
Options -MultiViews
</Directory>
</VirtualHost>
Now all we have to do is create a symlink in our sites-enabled folder to point the /var/www/webapp to our /apps/webapp/public folder, which looks like this.
ln -s /apps/webapp/public /var/www/webapp
Now was we are creating a symlink, we don't have to insert any extra code into our rails routes or environment file. You can specify which environment you would like to use using RackENV production (aparently al rails 3 + apps are rack ? please comment if this is not the case)

ubuntu returns 500 error when .htaccess enabled

I'm currently moving a dev magento build to my live test subdomain on ubuntu and using Easy Hosting Control Panel (EHCP).
If I rename my .htaccess file to .htaccess and refresh my subdomain url, I get an internal server error 500. If I rename the .htaccess file to .htaccess.bak, and refresh, the subdomain displays my magento store fine. BUT, if I try to navigate, since the index.php isn't removed in the .htaccess file, all my links are dead unless I insert index.php between my root url and the actual page/directory I'm navigating to.
I tried over riding the /etc/apache2/sites-available/000-default and /etc/apache2/sites-available/default files to AllowOverride All:
<VirtualHost *>
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/vhosts/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
<FilesMatch "access_log|error_log">
Deny from All
</FilesMatch>
ErrorLog /var/log/apache2/error.log
LogLevel debug
CustomLog /var/log/apache2/access.log combineddefault
but changing that in either file, or both, and then reenabling the .htaccess file still gives me the 500 error.
anything I'm doing wrong here? Somewhere else I should be placing the mod rewrite information?
thanks!
I know this is kind of dead but for those with this issue check your /etc/apache2/mods-enabled to see if rewrite.load is there if not try to copy it from the /etc/apache2/mods-available folder that fixed the issue for me. You will also have to have the .htaccess override enabled for that
is it rules available?
maybe apache is disabled rewrite mod,you can try to enable.
type 'a2enmod rewrite' to turn on.

Why can't I disable .htaccess in Apache?

This is the opposite problem from most about which I have read. I am running Ubuntu 8.04 on an Amazon instance with Apache 2.2.8 and I can't figure out why setting AllowOverride to None for root doesn't stop my .htaccess file from being included.
I have a sub-directory with hello.py in it and an .htaccess file. When I browse to the file, it works fine with modpython serving the file. If I put some garbage in .htaccess I get a server error, so I know the .htaccess file is being used. Also if I delete the .htaccess file, hello.py is no longer server by modpython - instead the browser tries to open it.
In one of my sites-available (linked in sites-enabled), I have "AllowOverride None" for the root directory. I thought that this would prevent .htaccess from being included from root and all its sub-directories which should cause hello.py to not be served by mod_python. However, it continues to be served fine and I can test that .htaccess is still being included because when I modify it, I see the results in my browser.
Maybe there is something I am not understanding about my file in sites-enabled. This is the file I am using:
NameVirtualHost *:8080
<VirtualHost *:8080>
<Directory />
AllowOverride None
</Directory>
</VirtualHost>
Thanks for any help.
The reason the file is not served via mod_python when you delete .htaccess is because the setup for mod_python is located in it. If you move that stuff to your sites-available file, you can delete .htaccess, turn a blind eye to the problem, and call it a day.
If that doesn't satisfy you, then as to why .htacess is being read at all, I can't say. You are correct that AllowOverride None should prevent the file from ever being read. Have you considered the possibility that you screwed something up when adding the virtual site? Try throwing some garbage into the config and see if it complains, just to be sure it's being read at all.
AllowOverride is only allowed in <Directory>-sections, so you've done everything right.
One problem you could have is that other (sub-)<Directory>-sections set AllowOverride to something different than None. That will override the setting for these subdirectories.
I use
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
allow from all
</Directory>
and in /var/www (my docroot) I can use .htaccesses.
The reason why mod_python does not work anymore if you delete your .htaccess is that mod_python setup is usually in .htaccess files.
If you need more information, please send us your configuration.
PS: In fact the docuementation linked above says that you should never set AllowOverride to something not None in <Directory />.

Resources