Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

4
votes
2answers
4k views

ErrorDocument in .htaccess, is it possible to use relative path?

This doesn't work: ErrorDocument 401 ../../src/wrong_pwd.php it renders the path as text, it really prints ../../src/wrong_pwd.php and doesn't output the real file. If I put the absolute ...
4
votes
1answer
71 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
240 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
152 views

Htaccess application/type with PHP as FastCGI

Is there a way to use .htaccess with PHP as CGI/FastCGI? I would like to be able to have other extensions open as PHP. I have tried the following: AddType application/fcgid-script .phpd AddHandler ...
4
votes
2answers
347 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 ...
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
4answers
1k views

Why do .htaccess redirects work in http but not with https?

I have a simple .htaccess file that works great on the http version of the site but not when I go to https. Why? RewriteEngine on #This is so if the file exists then use the file RewriteCond ...
3
votes
1answer
433 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
1answer
383 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
2answers
1k 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
72 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
2answers
635 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
10k views

How should I use the <If> directive in .htaccess?

I'm trying to add a conditional statement using Apache's If directive in my .htaccess file. I have referenced this page http://httpd.apache.org/docs/trunk/mod/core.html#if but it doesn't elaborate ...
3
votes
4answers
5k 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
1k 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
62 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
591 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
2answers
2k 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
8k 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
66 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
204 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
248 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
2k 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
2answers
708 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
4answers
4k 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 ...
3
votes
3answers
3k 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
4k 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 ...
3
votes
1answer
1k 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
238 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
276 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
1k 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 * ...
3
votes
3answers
1k views

Apache redirect to https for basic auth

I have a tricky variation on an old problem. I have an apache based site that should generally be accessed via http/port 80. However for certain areas protected areas that require authentication ...
3
votes
2answers
103 views

determining if .htaccess is working

Following some guide on the web, I have created the following .htaccess for my WordPress installation: # protect the htaccess file <files .htaccess> order allow,deny deny from all ...
3
votes
1answer
7k views

Enable php extension within .htaccess

Does anyone know how to enable a PHP extension within the .htacess file? Possibly: (.htaccess file) php_value extension=php_soap.so
3
votes
3answers
917 views

Need help finding what is wrong with my .htaccess not being read

I'm trying to use mod_rewrite through the .htaccess files and I have a big problem, the .htaccess files don't seems to be read. The machine is running Debian 5.0 and it's using the stable apache2 ...
3
votes
5answers
4k views

Apache Redirect folder to subdomain

A client had an application at www.domain.com/dir. They have now set up a subdomain at dir.domain.com. The subdomain references the files stored at www.domain.com/dir. They'd now like people accessing ...
3
votes
2answers
1k 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
723 views

Apache basic auth for a particular URL

I have a site in production that I want to modify (translate from French to English). The modified part will be placed in the domain.com/en URL location and I want to protect only this part with a ...
3
votes
1answer
231 views

htaccess IP blocking with custom 403 Error not working

I'm trying to block everyone but 1 IP address from my site on a server running apache & centos. My setup is follows the example below. My server: `http://www.myserver.com/` My .htaccess file ...
3
votes
1answer
117 views

Apache2 Basic Auth: user@ip, user2@ip2 - Is this possible?

I am looking at running an external service for clients to use here in my office while clients are working remotely at their office. Assumptions: Both my office IP and clients office IP are static. ...
3
votes
1answer
94 views

redirect 301 subdomain to same subdomain but in new folder

i want to redirect 301 subdomain to same subdomain but in new folder See what I mean .. http://sub.site.com/(.*) to http://sub.site.com/folder/ but when i go to folder the page not open Note: the ...
3
votes
1answer
480 views

Redirecting paths to shebang through .htaccess?

I had a small bit of code that would redirect pages accessed from my own domain to their hash addresses, like so: example.com/stationary.html => example.com/#/stationary This was the code: ...
3
votes
1answer
92 views

Part of my URL is being stripped away

I've discovered that one of the sites on our web server is having part certain URLs stripped away. Specifically, when a user clicks the link to display images as a slideshow the URL for that page has ...
3
votes
1answer
512 views

Image caching using HTTP_IF_MODIFIED_SINCE

I found that adding RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}] RewriteRule .* - [E=HTTP_IF_NONE_MATCH:%{HTTP:If-None-Match}] To the bottom of my htaccess file (below all ...
3
votes
3answers
8k views

Password protect directory with Apache: “couldn't check user. Check your authn provider!”

I am trying to password protect a web directory with apache. I have the site set up like this: D:/ webapp/ lib/ .htpasswd document_root/ admin/ index.php ...
3
votes
1answer
1k views

How to prevent external direct-link to files with htaccess?

I have this in my htaccess at the public_html folder of my file server: RewriteEngine On RewriteBase / ReWriteCond %{REQUEST_URI} ^/files/* RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} ...