Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

4
votes
3answers
15k 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 ...
4
votes
1answer
2k views

force https with apache before .htpasswd

I have this in my .htaccess file RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://www.myweb.com/phpmyadmin$1 [R,L] AuthUserFile /var/www/myweb/.htpasswd AuthGroupFile /dev/null ...
4
votes
2answers
3k views

Precedence of RewriteRules in .htaccess file on Apache Server

I have a number of RewriteRules in my .htaccess file. However, one specific rule is only executed if I remove another specific rule, regardless of how I order the two rules. Here's the rule which ...
4
votes
4answers
6k views

.htaccess not working (mod_rewrite)

Edit: I am pretty sure my .htaccess file is NOT being executed, and the problem is NOT with my rewrite rules. I have not having any luck getting my .htaccess with mod_rewrite working. Basically all ...
4
votes
4answers
6k 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
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
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
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
8k 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 ...
4
votes
1answer
515 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
250 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
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 ...
4
votes
1answer
3k views

Error headers: ap_headers_output_filter() after putting cache header in htaccess file

Receiving error: [debug] mod_headers.c(663): headers: ap_headers_output_filter() after I included this within the htaccess file: # 6 DAYS <FilesMatch ...
3
votes
2answers
2k 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
2answers
2k views

Is there a limit for .htaccess?

Hey all. I was just wondering if there's a limit for the .htaccess file for Apache 2. I'm working on a caching plugin and thaught that it might be a good idea to use the .htaccess file to point to ...
3
votes
1answer
782 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
1k views

How to dynamically reload nginx config

I'm currently trying to setup Nginx for a domain with production, testing and development stages. Each comes with it's own partial Nginx config file with rewrites. The production and testing stages ...
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
7k 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
81 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
446 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
795 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
9k 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
1k 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
4answers
7k 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
1answer
915 views

How do I get Apache2 to parse (without error) Header directives in a .htaccess?

I am getting pages loading with a 500 internal server error, due I believe to a directive that Apache has not been configured to allow. I have AllowOverride set to all, and a .htaccess file, ...
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
3answers
976 views

Configuring htaccess/mod_rewrite to serve static files with question mark in the URL

I've just taken on hosting of an ancient site that was converted from asp to static html, consisting of about 6,000 files. However, my server doesn't like the filenames, giving a 404 error. The URLs ...
3
votes
4answers
2k 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
907 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
2answers
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
3answers
10k 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
79 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
223 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
1answer
719 views

Conditional 301 redirect depending on server (localhost vs production)

By practise I do a 301 redirect non-www -> www for my production server deployments. But I have a little annoying problem/discrepency with the .htaccess rewrite settings between my development server ...
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
1answer
296 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 ...