Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

3
votes
2answers
3k views

In Apache does the .htaccess file override the httpd.conf for mod_rewrites?

In my Apache httpd.conf file I have this declaration inside a VirtualHost tag. RewriteEngine On RewriteCond %{HTTP_HOST} !^www.shanestillwell.com$ [NC] RewriteRule ^(.*)$ ...
3
votes
2answers
1k 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

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
255 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
283 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
3answers
1k 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
104 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
9k 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
4k 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
3k 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
1answer
538 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
126 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
114 views

redirect 301 subdomain to same subdomain but in new folder

i want to redirect 301 subdomain to same subdomain but in new folder See what I mean .. http://sub.site.com/(.*) to http://sub.site.com/folder/ but when i go to folder the page not open Note: the ...
3
votes
1answer
695 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
103 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
688 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
3answers
11k 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
414 views

Host Primary Domain from a subfolder

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
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> ...
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
292 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
861 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
200 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
4answers
445 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

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 ...
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
2answers
184 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
3answers
2k 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 ...
2
votes
2answers
14k views

How do you redirect URLs with a query string to another host?

This htaccess snippet is supposed to redirect myhost.com/?p=1&preview=true to alt.myhost.com/?p=1&preview=true RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^myhost.com$ [NC] ...
2
votes
6answers
327 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
1answer
515 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
8answers
10k 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
186 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
74 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
189 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
5k 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 ...
2
votes
2answers
7k 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$ ...
2
votes
2answers
702 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
2answers
146 views

Apache http to https redirection [duplicate]

I'm using below .htaccess rule to redirect all http requests to https. RewriteEngine On RewriteBase / RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} And it's working ...
2
votes
1answer
370 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
2k 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
517 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 ...
2
votes
2answers
5k 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 ...
2
votes
1answer
328 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 : ...