Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

2
votes
1answer
426 views

.htaccess Allow owner of home directory only?

Suppose I have a home directory "~someuser/www" which Apache (maintained by someone else than me) exposes as http://www.myserver.com/~someuser . If I want to limit this directory to certain users, I ...
2
votes
2answers
72 views

Make www.domain.com/admin points to a different directory other than /admin

The code is organized in the following directory structure: /frontend/ index.php ... /backend/ index.php ... Note that /frontend and /backend are at the same level. I have setup a ...
2
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] ...
2
votes
1answer
184 views

Redirect subdomain.xyz.com to subdomain.abc.com

Hey all, I'm trying to move to another domain, but have many subdomains under the existing domain. All the subdomains will be the same but just mapped with the new domain. [subdomain].xyz.com => ...
2
votes
1answer
2k views

How do you redirect pages from a subdirectory up one level to the root directory

I have recently moved all the content on my website from being in the www.mysite.com/shop directory to being in the root directory. This means that now I need to redirect any request to visit a page ...
2
votes
1answer
1k views

htaccess redirect of 404 error just prints filename, doesn't execute file

On an Apache host, I have a folder called /thumbs with a program in it called program.php that I will use to create thumbnails. There is a .htaccess file that contains the following lines: options ...
2
votes
1answer
7k views

How to exclude one subfolder from my RewriteRule Htaccess rules?

I have a .htaccess in my root of website that looks like this: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.mydomain\.pl [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?([a-z0-9_-]+)\.mydomain\.pl [NC] ...
2
votes
4answers
639 views

Lock down Wiki access to password only but remain open to a subnet via .htaccess

Basically we have a Wiki that has some sensitive information stored in it - not the best I know but my predecessor set it up. I want to be able to request password access from any one who is not on ...
2
votes
1answer
100 views

How to make htaccess not redirect to http on form submission

Part of my .htaccess file forces https on certain pages (e.g. when user logs in, enters credit card information, etc.) while forcing http on all other pages. This seems to be the ideal setup for what ...
2
votes
1answer
215 views

htaccess order Deny,Allow rule

I'd like to dynamically add IPs to a block list via htaccess. I was hoping someone could tell me if the following will work in my case (I'm unsure how to test via localhost). My .htaccess file will ...
2
votes
2answers
977 views

Block bots by their Java referrer or User-Agent string?

I have been getting a lot of web hits in my logs that crawl most top level pages of my site and show a referrer as a Java version. I see different variants of the Java versions in the referrer, i.e. ...
2
votes
2answers
620 views

Setting permissions for mp4 and png files in .htaccess

First, I'm brand new to Apache .htaccess. I've got a server that must allow users to dive only into mp4 and png files. So, I've been reading Apache HTTP Server documentation and, according to what it ...
2
votes
2answers
81 views

apache2 points non-www to root instead of website folder

I have few different vhost created and every one has its own folder in /var/www/ like this /var/www/example1/ /var/www/example2/ Now, when I type url with www www.example1.com it points to the ...
2
votes
3answers
192 views

Block Offline Browsers

Is there a way to block offline browsers (like Teleport Pro, Webzip, etc...) that are showed in the logs as "Mozilla"? Example: Webzip is showed in my site logs as "Mozilla/4.0 (compatible; MSIE 8.0; ...
2
votes
1answer
104 views

using .htaccess, is there a way to allow access to a file only if current date is between 2 dates

For a company campaign, we want a page to be available only between 2 datess. There a way to allow access to a file only if current date is between 2 dates using .htaccess??
2
votes
1answer
2k views

Why is the RewriteBase not working?

Here is what I am trying to do: domain is thinkingmonkey.me domain has 127.0.0.1 as IP addr mod_alias is installed. I have a conf file called directories.conf. In which I have all the ...
2
votes
1answer
258 views

How to I interpret these htaccess rewrite rules

I was given a set or re-write rules for a new website. I've never used them before and I'm trying to understand what we are doing here RewriteEngine on RewriteCond %{HTTP_HOST} . RewriteCond ...
2
votes
2answers
5k views

How to correctly restrict access to some folders via htaccess?

I have such directiry structure: - www - folder1 - folder2 - folder21 - folder22 - folder23 I allowed all image files to be accessed <FilesMatch ...
2
votes
1answer
1k views

LAMP: Custom 500 error page - is it actually possible?

As the Question title suggests, I want to setup a custom 500 error. In fact, I want to use a .php file for the error, and ideally send a 503 response (SE Reasons). The problem is that the only way I ...
2
votes
1answer
3k views

Whats the use of BrowserMatch or Options All in .htaccess?

I found these somewhere at the end of my htaccess file, from a time in history where I was in a mood of just adding as much as i could to my htaccess, now wishing the opposite: to remove everything ...
2
votes
2answers
1k views

Optimized .htaccess for caching?

I'm trying to make Google PageSpeed happy, but my .htaccess skills are limited. I'm particularly struggling with browser and proxy caching. Does anyone have a template I can use? Here's what I have ...
2
votes
1answer
2k views

Convert HTACCESS mod_rewrite directives to nginx format?

I'm brand new to nginx and I am trying to convert the app I wrote over from Apache as I need the ability to serve a lot of clients at once without a lot of overhead! I'm getting the hang of setting up ...
2
votes
3answers
2k views

.htaccess to deny access to most xml files

I recently had a Joomla site hacked, so I'm trying to harden the site a bit. There's a section in the recommended .htaccess that restricts outside access to the xml files that come with extensions. ...
2
votes
1answer
3k views

Problems redirecting Error 400 Bad Request to custom page

I've edited my .htaccess file to the following : ErrorDocument 404 /index.php?page=page-not-found ErrorDocument 400 /index.php?page=bad-request Now the error 404 redirects correctly, yet if i enter ...
2
votes
1answer
125 views

unique .htaccess question about mod_rewrite and RewriteCond

I have a few rewrite rules like these RewriteRule ^dir/(.*)-something.html otherdir/file1.php?var1=val&var2=$1 [L,NC] RewriteRule ^dir/ otherdir/file2.php?var1=val [L,NC] dir/ is not a real ...
2
votes
2answers
372 views

.htaccess subdomain to directory issue

I have this code below which is supposed to redirect a subdomain to a directory in .htaccess. What I am trying to do is make it so that every user on my site has their profile located at ...
2
votes
2answers
529 views

How do I get Apache to use a different local PHP.ini for different domains?

is there some sort of .htaccess directive. I dont have access to httpd.conf. I have php5 in a fastcgi/cgi module. Multiple domains. But for some reason all the domains are pointing to the first ...
2
votes
2answers
4k 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 ...
2
votes
1answer
66 views

Protecting Directory with .htaccess

Unfortunately with a product I rolled out, blackhatters found they could access an unprotected directory where I had the zip files. I use PHP to serve up those zips with readfile(), so normally in my ...
2
votes
2answers
138 views

Apache 2 does not load mod_deflate

I'm running Apache 2 on a Redhat Enterprise Linux 5.8 x86_64 standard box, and can't seem to get mod_deflate enabled. This is a WHM installation, so I am making amendments to one of the include files ...
2
votes
2answers
127 views

How to serve different application & server based on cookie

I'm building the frontend marketing website for a web application. The frontend is WordPress on one server and the app is on another. We will set a cookie for users who are already customers. For ...
2
votes
1answer
8k views

Increase the value of LimitRequestFieldSize in Apache

i have developed an application which uses a jQuery plugin, which in turn uses excess cookie data. the problem is after every 15-20 request i am shown this error message by the browser. Your ...
2
votes
2answers
78 views

Wordpress Website deploying challenge, remove “Allow from all” .htaccess

I am attempting to host my website. My host'er is telling me that they dont support "Allow from all" in .htaccess. Below are the contents of wp-content/.htaccess Order Allow,Deny Deny from all ...
2
votes
1answer
85 views

Consistent way to map .HTML as .PHP

We started including some PHP into our web pages, but we wanted to keep our incoming links working. Instead of a bunch of redirects, we simply mapped HTML files to PHP via: AddType ...
2
votes
1answer
46 views

.htaccess 301 redirect to new site

I want to redirect some of my old sites to my new sites. Some Googling suggest pasting this into my .htaccess: redirect 301 / http://new.com/ However, the new site does not have the same structure ...
2
votes
4answers
659 views

Htaccess strange behaviour with Nginx

I have a site running on Nginx (v1.0.14) serving as reverse proxy which proxies requests to Apache (v2.2.19). So Nginx runs on port 80, Apache is on 8080. Overall site works fine except that i cannot ...
2
votes
4answers
958 views

how to cache my website?

I have few questions about caching a website, since I haven't tried caching a site before. First is how to cache a site so it will have a faster loading when clients browse the site. For example I ...
2
votes
1answer
799 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 ...
2
votes
2answers
265 views

If a server doesn't have a .htaccess file, can adding a blank one cause problems?

The company I work for uses a number of hosting areas on different servers for different parts of our process. To begin with, we build things on our local machines and test them in localhost. Then, we ...
2
votes
2answers
185 views

What causes my .htaccess file to run multiple times on a single request?

I understand as far as what is happening with my code as to why I'm getting a infinite loop. So I have the following: <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteRule ...
2
votes
2answers
612 views

How do I do an .htaccess 301 redirect of a query string?

I'm trying to redirect a url http://domain.com/?p=106 to http://domain.com/?p=110 My .htaccess file looks like this: RewriteEngine On RewriteCond %{QUERY_STRING} ^p=106 RewriteRule / ...
2
votes
1answer
641 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 ...
2
votes
3answers
3k views

AuthUserFile path relative to virtual host root?

Given this folder / file structure: private/.htpasswd public/.htaccess ... where public is the root folder of a virtual host in Apache, and private is its sibling folder: How do I define a ...
2
votes
2answers
125 views

htacces & sub-directories

How could I give different access to sub-directories? The first problem is: I must let the programmers modify the htaccess files, but not the access control. I have access only to htaccess ...
2
votes
2answers
2k views

Apache crashing with memory/cpu overload when google crawler visits site

I have a site with low traffic, less than 500 hits a day. It has a 6G of memory and it is way underutilized, on average 5% is in use. But as soon as googlebot establishes a connection to my ...
2
votes
1answer
1k views

Htaccess tunnel to local server on another port?

Is it possible to have 2 web servers running on the same box with different ports and then use htaccess to tunnel traffic from 1 server to another based on a rewritecond? Basically when a certain ...
2
votes
1answer
268 views

Using .htaccess to exclude all user-agents for private site

In regards to a website that you want to keep private, in a situation where you can't restrict/allow to ip's for your users and password protection cannot be implemented. But you can have your users ...
2
votes
1answer
7k views

URL rewrite with multiple parameters using .htaccess

I've been trying to create some rewrite rules for the last few hours and I'm failing miserably. If anyone could help, I would be extremely grateful. I have four different types of rewrites I'm trying ...
2
votes
2answers
4k views

Prevent loop of RewriteRule in .htaccess

I am trying to introduce nice urls: RewriteRule ^(.*).html$ index.php?arianne_url=content/$1 [L] And i want to externally rewrite access to the old style urls: RewriteCond %{QUERY_STRING} ...
2
votes
1answer
860 views

Controlling clone access to multiple mercurial repos served via hgwebdir.cgi [duplicate]

Possible Duplicate: Read access control with Mercurial and Apache I'm trying to host multiple Mercurial repositories for my clients. I need to control access to each repository individually ...