Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

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
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 ...
2
votes
1answer
1k views

Nginx rewite rules 403 error

I am having trouble with converting .htaccess files to nginx. I have 3 .htaccess files. The first .htaccess file is located in the document root and is as follows: Options +FollowSymLinks ...
2
votes
2answers
241 views

.htaccess redirect visitor if he has a cookie is from accounts.google.com [closed]

I am creating a gateway page that redirects visitors based on what services they are using. How should a .htaccess rule that redirects a visitor if he has a cookie originating from the domain ...
2
votes
2answers
14k views

Apache .htaccess error: 'not allowed here' on Debian Wheezy

I am trying to configure an apache virtualhost which needs to be password protected in the root directory. So I created a .htpasswd file (with sha passwords) and configured the .htaccess file. ...
2
votes
3answers
4k views

How do you do wildcard subdomains?

I want subdomain.example.com to point to example.com/profile.php?user=subdomain With "subdomain" varying with user input How do you do that? Also, I want it to be a silent redirect, so the subdomain....
2
votes
2answers
10k views

One RewriteCond for multiple RewriteRules

I need to preserve all user query strings. RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^$ index.html?page=home&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^about$ index.html?page=about&...
2
votes
6answers
357 views

Using mod_rewrite to shutdown website

I am trying to shutdown a website to everyone except my ip address. I almost have it working. I cannot access www.mysite.com, but I can access all folders that have another .htaccess file in them. I ...
2
votes
5answers
2k views

500 Internal Server Error when adding a line in the .htaccess file

I need to add the following line into my .htaccess file in order to get my website working with mod_security SecFilterScanPOST Off but then I get an error Internal Server Error The server ...
2
votes
8answers
14k views

Excluding a directory from a root .htaccess rewrite rule to allow it to be password protected?

I have spent a tremendous amount of time the last week trying to figure this out, but no matter what I try I cannot get this to work. My web host said they did not have anyone who knew enough about ....
2
votes
4answers
203 views

Using .htaccess to hide files

Let's say I have an index.php file inside my public directory. Using DirectoryIndex index.php, I can set that file as my default index in my website. But what if I don't want users to enter through ...
2
votes
1answer
79 views

Should one put the Apache configuration into apache conf or .htaccess?

I've been wondering what is more efficient to use either configuring for instance the mod_rewrite rules on the conf file for the virtual host (loads once and that is it), or put it in the .htaccess ...
2
votes
2answers
217 views

Understanding .htaccess

I need to understand how .htaccess works. Can you give me some pointer, tutorials about how .htaccess works? Also, the scripting language from htaccess file is 'interesting'. What is it about?
2
votes
3answers
7k views

.htaccess requires password in chrome but not other browsers?

We have .htaccess on our site http://subdomain.site.com/: AuthType Kerberos AuthName "Internet ID" require valid-user order deny,allow deny from all allow from all On a sub directory of the site,...
2
votes
2answers
835 views

Can't figure out how to enable mod_rewrite on ubuntu

I feel like I've done everything right: josiah@BOX-OF-DOOOM:~$ sudo apache2ctl start apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ...
2
votes
1answer
830 views

Apache, htaccess, url rewrite

I have .htaccess file I'm using for testing, here is my file: RewriteEngine On RewriteCond %{REQUEST_URI} ^/([a-z-]+)/?$ [NC] RewriteRule ^ %{REQUEST_SCHEME}://%{SERVER_NAME}/?title=%1 [L] I'm ...
2
votes
1answer
5k views

Apache server-status returning 404, then redirecting to my Wordpress install

I'm trying to get Munin's various Apachie plugins to work on my web server, but I'm hitting issues. Upon asking Munin to check available plugins, two of the three Apache plugins return an error saying ...
2
votes
1answer
3k views

HTTPS for /wp-admin/ and HTTP for everything else?

I'm running a WordPress site on a shared Apache server on Dreamhost. I already have define('FORCE_SSL_ADMIN', true); set (and working) in my wp-config.php so that SSL is used for the /wp-admin/ ...
2
votes
2answers
570 views

Setting SSL redirect ONLY for the frontpage on Drupal?

I want users that visit my site to be redirected to the SSL version when they access it like this www.mysite.com But when they access other urls, such as... www.mysite.com/some www.mysite.com/...
2
votes
1answer
3k views

Force SSL for every URL except one path using .htaccess

I'm trying to enforce SSL for every URL except one with the first segment /preview. http://test.example.com/preview/blah/blah should be ignored by the rule; every other URL should be forced to use ...
2
votes
2answers
6k views

.htaccess deny from all does not work?

I am running Apache 2.2.20 on a Ubuntu 11.04 web server. I have a Joomla site running on it, but I have also added some custom content. In the main web directly I have added a folder /images/...
2
votes
1answer
482 views

htaccess email regex

I am trying to write a patter in such a way that this link : http://www.mysite.com/link/go/emailadress@gmail.com is interpreted like this : http://www.mysite.com/process.php?email=emailadress@gmail....
2
votes
2answers
8k views

Why doesn't my htaccess redirect work?

I have setup a simple htaccess redirect which looks like this (this is the whole .htaccess file): Options +FollowSymLinks RewriteEngine On Redirect 301 /something http://something.com/something.php ...
2
votes
1answer
361 views

Rewrite directory names to php files with htaccess?

Basically folder etc has files: contact.php help.php news.php How can I make /etc/contact direct to /etc/contact.php?
2
votes
1answer
202 views

Lighter alternative to Apache supporting .htaccess

Is there a lighter alternative (runs in shell, in one process, can be started and stopped easily by the user) to Apache that supports .htaccess files? If not, how could Apache be run in a "lighter" ...
2
votes
1answer
1k views

Proxy all requests for subdomain to an ip via htaccess/apache

Let's say I have the following subdomain with its own document root etc: monad2.mysite.com I want that all requests are proxied to an IP (for instance 193.159.3.129) but they must pass through the ...
2
votes
1answer
2k views

Hide cPanel login page? [closed]

I use the url http://example.org/cpanel to log in. This is accessible to anyone which seems like a bad idea as anyone can guess it's there. How can I hide it and make it accessible via .htaccess ...
2
votes
4answers
233 views

Rename url hiding file extension

I want to show the URL http://some.com/designit/portfolio.php?cat=website&subcat=nature as http://some.com/designit/portfolio/website/nature. cat and subcat in the URLs may be present, but not ...
2
votes
1answer
1k views

Apache htaccess passwd - ignoring correct login

I want to password protect a directory. I'm running Apache 2 with cPanel on Centos. For the sake of this post, the directory is /home/user/my-secret-dir I used cPanel's "Password Protect Directories"...
2
votes
1answer
193 views

Restrict audio file access by domain on S3 and/or Apache

We has some proprietary audio files we are streaming via html5. These files sit in an Amazon S3 bucket. The audio files have special high and low pass filters and other scientific alterations and ...
2
votes
1answer
642 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
81 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
2answers
4k views

htaccess to deny access to the current directory?

I'd like to deny access to directory /foo/secret. If I create a .htaccess file in /foo/secret, with... <Directory ./> Order deny,Allow Deny from all </Directory> ...I ...
2
votes
3answers
3k 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
257 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
5k 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
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
619 views

How to set htpasswd for all except LAN?

How can I set htpasswd prompt for everyone who want to access some server except people from LAN (192.168.0.*) ? Thanks for the answers !
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
8k 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
668 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
3answers
40 views

How do I set up a toggle for an Apache RewriteRule?

I have the following Apache config, which displays a 503 Service Unavailable error to all visitors except for my IP address: ErrorDocument 503 /503.html RewriteEngine On RewriteCond %{REMOTE_ADDR} !^...
2
votes
1answer
72 views

SuppressDescription Removes All Columns but the Name

I'm using mod_autoindex for some time with success (fancy index). However since I see no use for my "Description" column, I thought I'd remove it. According to the documentation, ...
2
votes
1answer
270 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
2k 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
3answers
5k views

Apache SetEnvIf failing to match Request_Uri

Simple condition, which never match and set variable: SetEnvIf Request_URI "^/path/to/something*" access_granted Checking URI by using PHP is giving correct string, however variable is never set. ...
2
votes
2answers
2k 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
3answers
1k views

Server remembering old rewrite rules, even when I remove htaccess

I have set up a development server with Ubuntu and LAMP, but for some reason the .htaccess is acting strange... There is a site on there with a set of rules, when I comment them out they still work, ...
2
votes
2answers
2k 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 ...