Apache http auth loop, Location and .htaccess together

I have an Apache auth loop. In my vhost config file, I have a Location directive to password protect a specific URL:

    <Location /academics/faculty-development>
            AuthUserFile /var/www/html/.htpasswd2
            AuthType Basic
            AuthName "Who's a good boy?"
            Require valid-user
            Order allow,deny
            Allow from all
    </Location>

However, I also have an .htaccess in our web root that protects the entire site.

AuthUserFile /var/www/html/.htpasswd
AuthType Basic
AuthName "Protected"
Require valid-user

Both logins work and authenticate, but when you log in with one, the other pops up. Logging in to that one makes the other come back.

How do I get my .htaccess to ignore authorization for that specific URL?

How to delete a subdirectory from a URL?

So I'm trying to turn my website from this:

http://profe5.com/Profe5-Web/public_html/login.html

To this:

http://profe5.com/login

I've been struggling to do this, but whenever I run it I get 404 error!

This is my htaccess:

    DirectoryIndex Profe5-Web
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^profe5\.com$ [NC]
    RewriteRule ^(.*)$ http://profe5.com/$1 [R=301,L]
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule ^([^\.]+)$ $1.html [R=301,L]
    RewriteRule ^Profe5-Web/public_html/(.*)$ $1 [R=301,L]

It would be so awesome if you guys could help me! Thanks so much!

Apache as a proxy

How can i configure Apache as a proxy which will not redirect my browser as shown in 2nd diagram below but return the actual content of the server behind the proxy as shown in 1st diagram

i found loads of sources to do the redirecting but not the config of proxing (hide url-send content from proxy)

i want following to happen

         ->       -> 
browser     proxy     web server
         <-       <-

not this

browser -> proxy
        <-
   |^
   V|
server

Annoying Silex subdirectory .htaccess issue

I'm working on a few projects using Silex and on none of them can I get the .htaccess file working. The current directory structure is http://localhost/IIV/

The front file in Silex is in http://localhost/IIV/web/index.php

This is what I have currently:

    Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /IIV/

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]

RewriteCond %{DOCUMENT_ROOT}/web/$1 -f
RewriteRule ^(.+?)/?$ /web/$1 [L]

RewriteCond %{DOCUMENT_ROOT}/web/$1 !-f
RewriteRule ^(.+?)/?$ /web/index.php [L]
RewriteRule ^(.+?)/?$ /web/index_dev.php [L]

Virtual host on ubuntu 13.10 and apache 2.4.6

I have the following problem
My hosts file is as follows:

127.0.0.1       localhost
127.0.1.1       barbala4o-HP-ProBook-4530s
127.0.1.1       mysite.localhost

My file in the /etc/apache2/sites-available/mysite.localhost.conf is as follows :

<VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName mysite.localhost

        DocumentRoot /var/www/mysite

        <Directory /var/www/mysite/>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
        ErrorLog /var/log/apache2/mysite-error.log
        CustomLog /var/log/apache2/mysite-access.log common
</VirtualHost>

After do sudo a2ensite mysite.localhost.conf and restart apache on mysite.localhost/ and only on localhost i get the following (like listing a directory without index file in it):

Index of /

[ICO]   Name    Last modified   Size    Description
[DIR]   apache_logs/    2013-09-24 10:15     -   
[DIR]   mysql/  2013-10-22 10:05     -   
[DIR]   tools/  2013-10-22 10:05

And on any other folder in the /var/www/ directory like test when i enter localhost/test instead of loading the index.php file it shows:

Not Found

The requested URL /adlantic was not found on this server.

Apache/2.4.6 (Ubuntu) Server at localhost Port 80   

If I do sudo a2dissite mysite.conf and restart apache everything is loading ok. I guess the problem is somewhere in the mysite.localhost.conf but I can't find where. Any ideas? 10x

.htaccess first 3 characters as folder

I'm not sure if it's even possible to do this, because searching for answer didn't help (although to be honest, I'm not really sure how to even google this). Anyways, I have a domain for static files (images) media.mydomain.com . All images have random names and are just there in the home folder of the domain. Like this: media.mydomain.com/123abcdefgh.jpg . However, I would like to organize them into folders, so I wouldn't have 100.000 files in one folder. Basically, I would love to have something like this media.mydomain.com/123/abcdefgh.jpg . First 3 characters of the string is folder name, others are file name. This URL also looks fine and if there's no solution, I will go with it. However, maybe it's possible to use .htaccess and somehow make it take first 3 characters of the request uri and rewrite them into folder and the rest of the string into filename? So when you go to media.mydomain.com/123abcdefgh.jpg server will access media.mydomain.com/123/abcdefgh.jpg . I hope my question is clear. Is is possible to do this somehow? Thank you in advance for your help.

RewriteCond with SetEnv

In my .htaccess I set:

SetEnv APPLICATION_ENV development

And I want to check if APPLICATION_ENV equals development then run app_dev.php, otherwise app.php

SetEnv APPLICATION_ENV development

RewriteCond %{ENV:APPLICATION_ENV} development
RewriteRule .? %{ENV:BASE}/app_dev.php [L]
RewriteRule .? %{ENV:BASE}/app.php [L]

However it does not work - always runs app.php script. How should I fix it ?

How do I change the default index page in Apache?

I would like to change the default web page that shows up when I browse my site. I currently have a reporting program running, and it outputs a file called index.html. I cannot change what it calls the file. Therefore, my landing page must be called something else. Right now, when I browse my site it takes me to the reporting page.

From what I see, whatever you call index.html it will pull that up as your default. I want to change that to landing.html. How do I do this?

I am a folder (Folding @ Home). The reporting program is HFM.net. HFM can output an html file with my current folding statistics. It names the html file index. I do not want that to be my default home page. I would like a menu-like landing where I can choose if I want to see my stats, or something else. The website is at /home/tyler/Documents/hfm/website (landing.html and hfm's index.html are here). Apache2 is in its default directory.

I'm also running Ubuntu 13.04.

When default virtualhost is not available, no virtual hosts are available

I have an apache2 instance proxying requests to several tomcat instances. Sometimes the default virtualhost is unresponsive (tomcat is running but app not responding). When this happens none of the other virtual hosts are reachable through apache but they work going direct to tomcat. Should the default virtualhost be a static page to avoid this issue? Any other settings to tell apache to skip the default if it doesn't respond?

In the httpd.conf there are proxypass/proxypassreverse statements outside of the virutalhost blocks. I don't know if that could be confusing things.

ProxyPass /test/ ajp://localhost:9009/test/
ProxyPassReverse /test/ ajp://localhost:9009/test/
ProxyPass /test2/ ajp:/localhost/9010/test2/
ProxyPassRevers /test2/ ajp://localhost:9010/test2/

NameVirtualHost 192.168.0.1:80

VirtualHost 192.168.0.1:80>
ServerName test.domain.com
ProxyPreserveHost On
ProxyRequests Off

...

ProxyPass / ajp://localhost:9009/test/
ProxyPassReverse / ajp://localhost:9009/test/

...
/VirtualHost>

VirtualHost 192.168.0.1:80>
ServerName test2.domain.com
ServerAlias test2
PorxyPreseveHost On
ProxyRequests Off
...

ProxyPass / ajp://localhost:9010/test2/
ProxyPassReverse / ajp://localhost:9010/test2/

...

/VirtualHost>

Solaris 10 apache 2.2.6 mod_proxy_ajp