Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

3
votes
2answers
4k 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
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
93 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
233 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
1k views

.htaccess in a directory makes it disappear from its parent’s listing

I have an Apache server running on a linux box (say example.com). Inside the web root is a folder (http://example.com/docs/, locally /home/me/docs), with an automatically generated index of its ...
3
votes
1answer
1k 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
1answer
359 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
1answer
782 views

Force HTTPS w/ Load Balancer and without (.htaccess rewrite)

I have the following code as a rewrite rule. RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L] This ...
3
votes
1answer
2k views

How multiple <Directory> sections work in Apache configuration (httpd.conf)?

For example, if my '/etc/apache2/httpd.conf' looks like this: <Directory /> AllowOverride None </Directory> <Directory /home> AllowOverride FileInfo </Directory> ...
3
votes
2answers
6k 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
2answers
9k views

Can't gzip some JS and CSS files

I am optimizing a magento store, and some JS and CSS (compiled and minified in a MEDIA folder) aren't being served gziped as they should. All pages are gziped (ex. this HTML page) but some content ...
3
votes
2answers
2k 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

Fully restrict access to sub-directories with .htaccess

With .htaccess, how can I block access to any sub-directories (and its contents) when they are accessed directly (using the browser's address bar for example)? I'm on a shared host, so I do not have ...
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
265 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
287 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 * ...
3
votes
2answers
2k views

Can I proxy my no-ip domain using a .htaccess file on my hosted domain?

I have a domain http://www.example.com which has a hosting package and website on it. I also have a http://example.no-ip.org domain which contains some content I would like to appear under the same ...
3
votes
3answers
2k 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
106 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
11k 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
1k 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
5k 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
624 views

Redirect depending on preferred language (Accept-Language) with .htaccess

When users request /, I want to redirect them to /en or /de, depending on their preference specified in the HTTP request header Accept-Language. I guess this is easy with server-side scripting, but I ...
3
votes
1answer
905 views

Blocking all users without referrer BUT allowing Googlebot/bingbot at the same time (with .htaccess)

Because of some amateur-made DDOS attack on my website, I had to deny some traffic with .htaccess which worked fine. Unfortunately, it also blocks the googlebot/bingbot: order allow, deny deny from ...
3
votes
4answers
4k views

apache 2.4, mod_proxy_fcgi not honouring .htaccess, work around needed

I am using apache 2.4.7 with mod_proxy_fcgi for purpose of passing through php to php-fpm (this will be used for shared hosting environment). The htaccess works fine for non php files, but once it hit ...
3
votes
1answer
856 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
138 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
153 views

redirect 301 subdomain to same subdomain but in new folder

I want to redirect 301 subdomain to same subdomain but in a new folder. So I want to redirect http://sub.example.com/(.*) to http://sub.example.com/folder/ But when I go to folder the page does not ...
3
votes
1answer
927 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
109 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
898 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
1answer
792 views

mod_rewrite !-f and !-d ignored for .php extensions

I have an .htaccess file on an Apache 2 server: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond ...
3
votes
3answers
12k 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
2answers
430 views

Host Primary Domain from a subfolder [closed]

I am having a problem making a sub directory act as the public_html for my main domain, and getting a solution that works with that domains sub directories too. My hosting allows me to host multiple ...
3
votes
1answer
3k views

allowing index access only with .htaccess

I have this in my .htaccess file, in the site root: Options -Indexes <directory ../.*> Deny from all </directory> <Files .htaccess> order allow,deny deny from all </Files> ...
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} ...
3
votes
1answer
449 views

htaccess rewriting all subdomains to subdirectories

I'm trying to build a catch-all for any subdomains (not captured by previous rewrite rules) for a certain domain, and serve a website from a subdirectory that resides in the same folder as the ...
3
votes
1answer
1k views

How to exclude IP from htaccess domain redirect [duplicate]

I'm trying to write a custom redirect rule for some testing purposes on 2 domains with exactly same site. The code I am using is: RewriteEngine on RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$ ...
3
votes
1answer
215 views

Trouble with www. redirect (.htaccess)

I'm trying to get a simple www. to non www. redirect set up. Here's the .htaccess DirectoryIndex index.php RewriteEngine On RewriteCond %{HTTP_HOST} ^www.domain.org [NC] RewriteRule ^(.*)$ ...
3
votes
2answers
1k views

URL Rewriting Problem [duplicate]

I'm trying to rewrite my URL's subdomain. http://username.domain.com will show content of http://www.domain.com/user.php?u=username but URL stay as http://username.domain.com . (I mean url masking) ...
3
votes
2answers
50 views

Redirect directory content

I have the following directories on my Apache server: root/dir1/ root/dir2/ root/dir3/... Is it possible to make the contents of my sub-directories (dir1, dir2, dir3) "as if" it was directly in ...
3
votes
3answers
1k views

.htaccess per directory in nginx

I am new to nginx and I have been on apache before. In apache, each directory can have a .htaccess to target the directory and and it's subdirectories. Is this possible for nginx? If so, how do I do ...
3
votes
4answers
457 views

Internal server 500 error

Hello Everyone I have created the following script in my .htaccess file Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} domain.eu RewriteCond %{REQUEST_URI} !^domain RewriteRule ...
3
votes
1answer
2k views

Subdomain doesn't work without www in front of it [duplicate]

I had a subdomain setup in cpanel before (sub.domain.com to redirect to domain.com/sub/) and suddenly today I noticed that it was rewriting the URL in the browser to www.domain.com/sub/ instead of ...
3
votes
1answer
591 views

Htacess rewrite for AngularJs App

I need help regarding AngularJs application. I need htacess file for HTML5Mode in AngularJS and Hashbang fallback. Can someone help me? Cuz i get %2F when i use backslash. I've been folowing along ...
2
votes
4answers
10k views

.htaccess does not ask the password

I am using Ubuntu 12.04 and trying to use .htaccess on a page with apache2 server on it. My .htaccess file looks like this: AuthType Basic AuthName "Password Required" AuthBasicProvider file ...
2
votes
2answers
146 views

cant upload .htpasswd

G'Day Faulty Friends, I just tried to upload .htaccess & .htpasswd to a clients server over FTP, and although the FTP process seems to go smoothly, refreshing the view shows that neither file are ...
2
votes
5answers
21k views

Redirect all http AND https non-www URLS to https://www.example.com via htaccess

For reasons much too long and complex to get into (it involves several layers of corporate red tape resulting in someone else not purchasing a wildcard SSL certificate I requested), I have to set up a ...
2
votes
5answers
2k views

.htaccess being hacked repeatedly [duplicate]

About 4 or 5 days ago, a client came back to me saying that their site was being redirected to some other suspicious looking website from Google, Yahoo, etc., but it was working fine when the user ...