Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

22
votes
3answers
41k 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 ...
2
votes
1answer
643 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 ...
8
votes
5answers
2k 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 ...
5
votes
5answers
47k views

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

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 ...
0
votes
2answers
1k 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
3answers
3k 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 ...
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 ...
20
votes
4answers
35k 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 ...
6
votes
4answers
26k 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
2k 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
3k 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'. ...
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 ...
5
votes
1answer
117 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
4answers
3k 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 ...
3
votes
2answers
257 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
7k 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
1answer
2k 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> ...
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 ...
1
vote
1answer
183 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
15k 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
4answers
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 ...
2
votes
2answers
84 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 ...
1
vote
1answer
3k views

Denying access to all files except index.html apache

Could someone help me with apache .htaccess file to deny access to all files and sub directories except for index.html on the documentroot for an apache server? I tried: <Location /> Order ...
1
vote
1answer
921 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/ ...
1
vote
4answers
406 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
658 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
320 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
233 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
2answers
902 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
812 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 ...
10
votes
3answers
17k 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
12k 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 ...
8
votes
1answer
4k 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 ...
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 ...
0
votes
2answers
1k views

where to put wordpress htaccess on openshift

I have cloned my wordpress application from openshift with git, in my cloned application there is php folder, when i put my htaccess file in it then i commit my changes like this : git add -A git ...
6
votes
4answers
4k 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 ...
5
votes
3answers
7k 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) ...
4
votes
2answers
2k 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 ...
3
votes
1answer
307 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
9k 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 ...
1
vote
3answers
3k views

Redirect HTTPS to HTTP except for specific URL

We'd like to redirect all HTTPS traffic to HTTP except for a specific URL which is /user/login So far we've got: RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^user/login(.*)$ ...
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
7k 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
5k 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
4k 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
1answer
121 views

Can Apache .htaccess convert the percent-encoding in encoded URIs from Win-1252 to UTF-8?

I want to add a directive in my .htaccess, such that if the browser is pointed at a URI containing %E4 (ä) - or any other special character - the .htaccess automatically rewrites %E4 (ä) as %C3%A4 ...
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
2answers
746 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
560 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, ...