Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

8
votes
5answers
1k views

How to prevent hot linking (“image theft” / “bandwidth theft”) of ressources on my site?

I'm trying to write the "ultimate" anti hot linking .htaccess... You can find many examples/tutorials/generators on the net but many of them are wrong or incomplete (or even both). These are the ...
14
votes
3answers
25k views

How to redirect root and only root via htaccess?

I want to redirect only my root to another url, but maintain all the /sub/directories where they belong (and redirect) example: mysite.com/1 redirects to somewhere mysite.com/admin opens a page i ...
0
votes
2answers
734 views

My php homepage downloads index.php instead of being processed on Gandi.net

if I go to the homepage of my website http://www.website.com (on a brand new server) the index.php gets donwloaded instead than processed. I don't have the same problem on other folders. my .htaccess ...
1
vote
0answers
1k views

Apache .htaccess trick to authenticate only once for all subdomains? [duplicate]

Possible Duplicate: Apache .htaccess trick to authenticate only once for all subdomains? I'm using something like this in .htaccess file to restrict access to the website: AuthUserFile ...
1
vote
3answers
2k views

Apache .htaccess trick to authenticate only once for all subdomains?

I'm using something like this in .htaccess file to restrict access to the website: AuthUserFile /some/directory/.passwd AuthGroupFile /dev/null AuthName EnterPassword AuthType Basic require ...
2
votes
2answers
1k views

Mod ReWrite Catch-All Subdomain

Basically I want *.domain.com to pull up domain.com/*/ (not redirect). I went into the subdomains section of cPanel and set a wildcard for this domain. It appears to be resolving correctly, ie ...
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
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", ...
2
votes
1answer
2k 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
1k 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> ...
1
vote
1answer
144 views

Why servers error log states lots of file doesn't exist, but files are accessible and website works well

we migrated our website onto VPS server (CentOS 5.6 + Plesk 9.5), everything works nice, but one strange thing that i noticed in Plesk, is error_log file, most of the time it filled up with hundreds ...
0
votes
2answers
11k views

Apache Virtual Host with Alias

I have a virtual host running on my local copy of Apache. It has an alias. <VirtualHost 127.0.0.1> ServerName oliverash.me.dev DocumentRoot "/usr/docs/oliverash.me/public" ...
5
votes
3answers
3k views

Returning 404 code for unauthorized attempts

I have an admin directory on my web server (http://test.com/admin) and I don't want unauthorized parties to access this /admin/ directory instead I want to return 404 error code for all unauthorized ...
4
votes
4answers
2k views

How to set up a DNS to use a catch-all address?

This is not really a programming question, it's more about settings that I can alter visually. I have bought a domain and am wondering how I can get it work in such a way that everything before the ...
2
votes
5answers
28k views

How do I use .htaccess to always redirect from HTTP to HTTPS?

There's a few similar questions which I tried to work out the answer from, but so far I have been unsuccessful. Please advise how I can always redirect http to https (and also remove www. from the ...
1
vote
1answer
900 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'. ...
1
vote
4answers
373 views

Adding dynamic subdomains to my webserver?

I'm trying to add a wildcard sub-domain system to my web server, but its still not working, These are the steps I took: I made a new file, vhost.conf, in the directory ...
0
votes
4answers
390 views

403 Forbidden Access

Yesterday my supervisor mounted one of his directories onto my server. The problem is, I can't access them and I have no way of contacting him right now. When I type in the URL I get this error: ...
0
votes
2answers
299 views

nGinx non-www to www redirect

I have been working with apache for years and now wanted to move to nGinx keeping in view the performance everyone on internet seems to be talking about. But I its very frustrating for me for not ...
0
votes
1answer
202 views

htaccess rewrite rule

Well i have this code into my .htaccess file Options +FollowSymlinks RewriteEngine on AddDefaultCharset UTF-8 RewriteCond %{THE_REQUEST} ^[A-Z]+\ (.+)\.php [NC] RewriteCond ...
0
votes
1answer
682 views

how to redirect www.example.com to example.com via htaccess while on zend framework

as you may know zend framework uses .htaccess for redirection purposes so when I tried to follow this advice: http://techpp.com/2010/06/28/how-to-redirect-www-urls-to-non-www-urls-and-non-www-to-www/ ...
0
votes
2answers
897 views

Apache mod_rewrite not working

I installed Apache through its windows installer and then PHP and MySQL too. Wordpress is working fine on this setup so it means the basic setup required is working fine. But somehow mod_rewriting is ...
0
votes
3answers
783 views

apache rewrite to assign folders to domains

Please point me in the right direction. I am using .htaccess to set-up domains on my server. I need to domain.com to access files from /domain.com/* folder. If a file does not exist, load ...
-1
votes
0answers
15 views

Duplicate Content error [migrated]

I actually wanted say that - My current URL is – www.example.com/category/we-developer/ However, if any user is mistakenly putting extra characters after the '/', for example, ...
14
votes
4answers
19k views

How to get apache2 to redirect to a subdirectory

I am running apache2 on debian etch, with multiple virtual hosts. I want to redirect so that http://git.example.com goes to http://git.example.com/git/ Should be really simple, but google isn't ...
8
votes
2answers
14k views

Configuring favicon with expires header in htaccess

I have implemented Expires headers via mod_expires on my Apache server and have successfully created expires headers for most file types, however I am having trouble with the favicon. I initially ...
6
votes
3answers
10k views

Creating a cookie-free domain to serve static content

I am trying to create a "example.com" domain to serve static content to my original domain. How would I make the "example.com" domain to so its cookie-free when loading content? I am thinking that ...
6
votes
1answer
3k views

max length of url 257 characters for mod_rewrite?

My url scheme is /foo/var1-var2-var3.../bar I am using these mod_rewrite rules: RewriteBase /foo/ RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d ...
5
votes
3answers
19k views

IIS7: How to block access with a web.config file?

I know that IIS7 allows me to have a per directory configuration with the web.config xml file. I have a directory with some configuration files that don't want to be web accessible. A local web.config ...
4
votes
1answer
1k 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 ...
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?
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 ...
5
votes
1answer
94 views

How to minimise effect of mischievous, persistent POST requests

For a few months now one of our shared hosting servers has been persistently and constantly hammered by "POST /" requests from what must be hundreds of thousands of individual IPs. On a number of ...
5
votes
3answers
6k views

How can I password prompt certain IPs and allow all others free access using Apache?

SOLVED: The idea is that if the visitor comes from China they have to pass a basic authentication. If you have any other IP address you can visit the site without being hassled (including proxies) ...
3
votes
1answer
249 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 ...
2
votes
1answer
1k 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 ...
1
vote
5answers
2k views

How can I prevent hotlinking? (nginx)

I use nginx and I have no access to server conf. May be with .htaccess analogue?..
0
votes
5answers
6k views

Apache .htaccess problem: No input file specified

Can someone help me with this. I'm feeling like I've been hitting my head against a wall for over 2 hrs now. I've got Apache 2.2.8 + PHP 5.2.6 installed on my machine and the .htacces with code below ...
4
votes
2answers
3k 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
4answers
3k 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 ...
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
5k 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
0answers
95 views

How to set up a DNS to use a catch-all address? [duplicate]

Possible Duplicate: How to set up a DNS to use a catch-all address? This is not really a programming question, it's more about settings that I can alter visually. I first asked this at ...
2
votes
2answers
705 views

Order of mod_rewrite rules in .htaccess not being followed

We're trying to enforce HTTPS on certain URLs and HTTP on others. We are also rewriting URLs so all requests go through our index.php. Here is our .htaccess file. # enable mod_rewrite RewriteEngine ...
1
vote
4answers
113 views

HTTPS / HTTP mod_rewrite rules, strange interaction with subsequent CMS index.php rewrite

With the below rewrites in htaccess, as expected, this HTTPS request is not rewritten: https://example.com/system/anything is not re-written to http://example.com/system/anything But, ...
1
vote
1answer
371 views

Internet explorer cannot display the page, other browsers can, possibly htaccess / server error

After the migration of a high traffic site, from Redhat to Suse, Internet Explorer users (of at least IE 9) have, in some cases, troubles to view the frontpage (error message: "Internet explorer ...
1
vote
1answer
5k views

Why do I get page not found (404) for correct links?

I have a very strange issue: Google is giving me that some links in my sitemap are not accessible and are giving 404 errors. However, I have tried to open the pages in question and it works fine. The ...
1
vote
2answers
287 views

Why do two patterns (/.*) and (.*) match different strings?

Shouldn't the two patterns (/.*) and (.*) match the same string? My real question is actually: where did the "abc" go? Something funky seems to be happening inside the mod_rewrite engine... Given ...
1
vote
2answers
592 views

Apache error log; Php error file does not exist; Think it has something to do with mod_rewrite

I get a whole bunch of these errors, but with different ad id:s in the end. The one below has ad id "Bmw_m3_brand_new_2939822" [Fri Oct 29 22:57:37 2010] [error] [client 111.111.11.11] File does not ...
1
vote
1answer
136 views

Apache Allow or Redirect users

I'm trying to use a .htaccess to Redirect people that are not from a certain IP range. Redirect is working ok, but I can't figure out how to do both at the same time: - People within a certain range: ...