Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

4
votes
4answers
5k views

.htaccess RewriteCond for REMOTE_ADDR while behind Load Balancer?

I have a web server behind a load-balancer. I need to add a conditional redirect to my .htaccess in order to display a maintenance page whenever we take the site offline for maintenance. This part is ...
4
votes
1answer
3k views

Why would an .htaccess file result in 403 Forbidden when the only line is “Allow from all”?

I'm running a server: Apache/2.2.8 (Ubuntu) mod_ssl/2.2.8 OpenSSL/0.9.8g Without a .htaccess file, everyone can access the web content. However, I add a .htaccess file with the following content: ...
4
votes
4answers
6k views

.htaccess file hacked, how to prevent this in future? [closed]

The hacker added a code in .htaccess file to redirect all search engine traffic to a malware website. I am now investigating this incident and trying to find out security loop holes. My situation is ...
4
votes
2answers
4k views

IIS Basic Authorization ala .htaccess/.htpasswd in apache

How do I implement the protection of the pages (asp.net mvc app), so when I hit the home page or any other pages within the application I get a login dialog popup in the browser I'm looking for ...
4
votes
1answer
5k views

Handler for (null) returned invalid result code 70007 / causing error 500?

I am getting these errors on some pages in my site (php/apache/linux/mysql vps) on intervals and can't seem to find any reproducible scenario : Handler for (null) returned invalid result code ...
4
votes
4answers
4k views

How can I perform a syntax check on an .htaccess file in a shared hosting environment?

I have a build script (Perl) that modifies the .htaccess file when I deploy my applications. As a double-check, I'd like to be able to perform some sort of syntax checking on the created .htaccess ...
4
votes
1answer
3k views

htaccess redirect all to one file (except from localhost)

I want to redirect all traffic to a single .php gateway file, this file will do authentication and use ajax to pull the file that was requested. So I need a .htaccess with flow like this: if ...
4
votes
1answer
495 views

Why isn't htaccess following this php_value directive?

In .htaccess I've added php_value session.name "SID" This seems to have no effect, however, and no errors are thrown in error_log. Other rewrite rules in the same .htaccess file are working as ...
4
votes
1answer
78 views

.htaccess help?

First, sorry for the shocking level of no-coding-skills. So what is probably best is that I describe what I want first. I have 2 domain names, linking to one hosting package (yes, cheap-ass option, ...
4
votes
1answer
249 views

How to redirect elgantly many redirects in htaccess?

Q1. is it possible to further optimize / compact the following rules, thereby making the entire redirections faster and easier to maintain in future? There are about twenty of these domains!! you get ...
4
votes
1answer
1k views

Have .htaccess dynamically get RewriteBase

Depending on where I install my set of files, it seems like RewriteBase seems has to change accordingly if I install it in a subdirectory rather than at the www root. For my configuration files, I ...
4
votes
3answers
803 views

.htaccess redirect all extension to php

I recently updated my .htaccess file to hide the .php extension of the urls. It works nice, when I try to reach domain.com/index, it displays the php file. When I type domain.com/index.php it ...
4
votes
1answer
2k views

Apache sends plain-text response when accessing SSL-enabled site without HTTPS

I've never encountered something such as this before. I was attempting to simply redirect the page to the HTTPS version if it determined that HTTPS was off, but instead it's displaying an HTML page ...
3
votes
2answers
1k views

How do I prevent my swf files being hotlinked, downloaded etc

I have swf files that are embedded in a PHP page using SWFObject. These swf files are in the same directory as my PHP files. for example www.myurl.com/index.php embeds www.myurl.com/flashfile.swf, ...
3
votes
7answers
3k views

How can I find the URL of a redirect?

I'm taking over hosting of domain that simply redirects to its online booking page of a third party provider. Because the landing page is http://example.com/generic/booking.asp I'd like to know how ...
3
votes
1answer
688 views

When does Apache re-read the updates to .htaccess files?

I have a hosted server. When I update .htaccess, are the updated rules immediately in effect? I understand that hosters can do what they want, and it's impossible to know without knowing the ...
3
votes
2answers
3k views

Only allow GET request with htaccess?

How should I allow only GET request to access all the files and script from my server using htaccess? My web server is Apache
3
votes
2answers
2k views

Setup IIS to prompt for username/password Window instead of using a form?

On a linux box using .htaccess you can deny access to folders etc... and when the user attemps to visit that directory/file, a window pops up asking for username/password. How would you do this on ...
3
votes
2answers
6k views

What is nginx equalant for my htaccess mod_rewrite?

Previously i was using linode VPS running Apache for my CodeIgniter website. Today i installed nginx and my website landing page is coming but the other pages that is using htaccess for rewriting URL ...
3
votes
2answers
77 views

Redirect absolutely anything to new domain with .htaccess

Ok, so I'm in need a simple redirect: Redirect 301 / http://www.new.com/ Similar to that, except I want it to catch anything, such as: ...
3
votes
1answer
428 views

Adding empty .htaccess gives 403 error

When I add an empty .htaccess file to server root (touch .htaccess) I get a 403 error. The samme error appears no matter what I put in the file (I've tried specifying <LIMIT> directives etc). ...
3
votes
3answers
667 views

htaccess vrs httpd.conf?

Is it still true that you shouldn't use htaccess files if you can use httpd.conf? The Apache site says "In general, you should never use .htaccess files unless you don't have access to the main ...
3
votes
2answers
8k views

Convert and redirect URL in uppercase to lowercase using .htaccess

I would like redirect a URL with uppercase characters http://localhost/A/B to a lowercase version http://localhost/a/b using the .htaccess file. Using regex I can capture A and B but is it possible ...
3
votes
1answer
976 views

.htaccess not working on Cent Os 6.4

I have installed Cent Os 6.4 -Final Version and set the environment for PHP web development. My application uses the .htaccess for url rewrite & denying direct access of files. my configuration ...
3
votes
2answers
1k views

mod_rewrite remove trailing slash is causing loops

I have a site using mod_rewrite to make pretty URLs ... everywhere I read the removing the trailing slash is good for SEO and therefore I went with the rule: RewriteRule ^(.+)/$ /$1 [R=301,L] I ...
3
votes
1answer
2k views

.htaccess - redirect non www to www and retain subdomains from redirecting

So, on my main domain 'domain.com' I created several subdomains from cPanel, like 'sub1.domain.com' and 'sub2.domain.com'. Their real location on server is in 'domain.com/sub1' and 'domain.com/sub2'. ...
3
votes
3answers
2k views

How to throw a 404 error from htaccess?

Everything I find seems to be about created a custom 404 page. That is not what I am trying to do. If I want to block access to a page I can do this in htaccess: RewriteRule pattern - [F] ...
3
votes
1answer
2k views

Does is matter in what order rules are placed in htaccess?

I hope this is a simple YES or NO answer (please specify why) Q1: Does is matter in what order the rules are placed in htaccess? Since they are completely separated items: for example Q2: If yes, am ...
3
votes
4answers
6k views

How to redirect non-www to www without hardcoding using .htaccess?

RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] ...causes a perfect, non-hardcoding 301 redirect from "www to non-www", ...
3
votes
3answers
2k views

How can I upload/download or modify .htaccess files using WebDAV?

I've set up a Ubuntu server with Apache 2. Instead of FTP I'm using WebDAV upload/download files. Works great. But it is not possible to upload/download or modify .htaccess files, because the Apache ...
3
votes
3answers
65 views

What's the proper way to setup a client chosen domain name?

In my web app, I'm toying with the idea of giving my user the opportunity to select a subdomain of their choosing, so they could select something like: foobar.myapp.com where foobar is their chosen ...
3
votes
4answers
1k views

Basic Auth on DirectoryIndex Only

I am trying to configure basic auth for my index file, and only my index file. I have configured it like so: <Files index.htm> Order allow,deny Allow from all AuthType Basic ...
3
votes
4answers
1k views

Different Expires Header for Specific URL

The whole application has a global expires header set in the .htaccess I have a URL e.g. /current which I need like a different expiry header.
3
votes
2answers
820 views

Configure session length with htaccess

My home web server is running the stock OSX Apache 2 install. I have some directories with content that I want to secure, so I setup htaccess files for those areas. However, I find it annoying to ...
3
votes
3answers
1k views

Set MIME type of PHP generated JavaScript file

I have a dynamically created .js file by PHP. For this to work I added the following to an Apache .htaccess file: AddHandler application/x-httpd-php .js AddType application/javascript .js But the ...
3
votes
2answers
3k views

RewriteRules not stopping with LAST flag?

I seem to be having trouble with Apache 2.2's Rewrite module (running on FreeBSD 8). My .htaccess file is as follows: Options -Indexes RewriteEngine on RewriteRule ^xpaste$ cross.php [L] ...
3
votes
3answers
9k views

How to create and edit .htaccess and .htpasswd locally on my computer and then upload to my site via ftp?

I'm making a website for a client, and I want to make a password protected directory. The problem is my account type only allows FTP, so is there any way to create the .htaccess and .htpasswd files ...
3
votes
1answer
2k views

How to block PROPFIND (or any other method) on Apache

How can I block PROPFIND (or other methods, such as PUT or DELETE) on my whole site with Apache?
3
votes
3answers
76 views

Does high traffic on HTACCESS affect the server?

i have a website and a sub domain.. the main website is hosted in server A and its sub domain in server B.. main website = server A sub domain = server B when i have high traffic i will ...
3
votes
1answer
220 views

htaccess mod_rewrite conundrum

Ok, so I have this .htaccess file that contains this <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} ...
3
votes
3answers
4k views

.htaccess error “not allowed here” for all for all instructions

I am using Debian Lenny and Apache 2. I changed the default .htaccess file with: AllowOverride AuthConfig But I always get the error message not allowed here when putting any instructions in the ...
3
votes
3answers
13k views

.htaccess is ignored even though VirtualHost has “AllowOverride All”

I'm running a LAMP server on Fedora 13 that's working fine; however, I just added an ".htaccess" file to my current site's docroot folder that is being completely ignored. I've tried half a dozen ...
3
votes
1answer
282 views

Setting up a complex Apache reverse proxy

We are about to move a website to a new server running a new piece of software, normally a simple change but we also have a dutch version of the website running in a folder /nl. We would like to ...
3
votes
2answers
3k views

In Apache does the .htaccess file override the httpd.conf for mod_rewrites?

In my Apache httpd.conf file I have this declaration inside a VirtualHost tag. RewriteEngine On RewriteCond %{HTTP_HOST} !^www.shanestillwell.com$ [NC] RewriteRule ^(.*)$ ...
3
votes
1answer
6k views

Why is allow not allowed here in apache2

I've the following in my httpd.conf file: <Directory "/www"> Options Indexes FollowSymLinks AllowOverride AuthConfig FileInfo Options=Indexes,Limit Order allow,deny Allow from ...
3
votes
2answers
966 views

How should I separate public and private pages on my webserver?

What I want to achieve I have public and private sites on my webserver, and I would like to somehow separate them, but I want this separation to be invisible. So for example DocumentRoot is /var/www ...
3
votes
1answer
2k views

Block A City From Visiting my Website [closed]

I understand it is possible to block a country from viewing my website using apache, .htaccess. I was wondering if it is possible to block everyone from a specific City (namely the city of Flower ...
3
votes
2answers
252 views

Is there an Elegant solution to rewrite long image?query-urls into cachable_nice_urls, using only apache htaccess?

this is a pain in the ass-problem! Whicever genius solves this riddle will receive paypal donation to eat diner for two. Now lets get started. Given: most proxies, do not cache resources with a "?" in ...
3
votes
6answers
281 views

htaccess noob needs your opinion and elite skills :)

brand new with .htaccess and I have read the howto's for weeks along with a load of experimenting. I desperately need someone to look at the thing for me and tell me if anything is wrong or just plain ...
3
votes
1answer
2k views

Apache: How to redirect OPTIONS request with .htaccess?

I have Apache 2.2.4 server with a lot of messages like this in the access_log: ::1 - - [15/May/2010:19:55:01 +0200] "OPTIONS * HTTP/1.0" 400 543 ::1 - - [15/May/2010:20:22:17 +0200] "OPTIONS * ...