Questions tagged [htaccess]

The hypertext access web server configuration file used for overriding configuration on a per-directory basis.

164 questions
62
votes
7 answers

How do I rename a file to .htaccess in Windows 7?

I'm using XAMPP to test a PHP script. Now, in the root of the folder I want to place a .htaccess file according to the requirements of the script. But Windows won't let me rename it to .htaccess. Is there any way to go around it? I'm using Windows…
rzlines
  • 7,678
14
votes
5 answers

How do I block a host by ASN? Example - AS16276

There are a handful of especially toxic hosts out there. There is no reason we need to allow any of their IP's access to our servers. Is there a way we can block them using their ASN or other global identifier? I would prefer to do this in HTACCESS…
dhaupin
  • 433
10
votes
1 answer

How to show the whole file name while using .htaccess to list files in a directory?

My .htaccess file looks like this : Options +Indexes When I look at the directory from my browser, it looks like this: File names that are too long are truncated, how can I make it show the whole file name?
Frank
  • 441
9
votes
1 answer

.htaccess 301 redirect with regular expressions

If I have: redirect 301 /users/foo http://www.example.com/profiles/foo redirect 301 /users/bar http://www.example.com/profiles/bar Can I do something like? redirect 301 ^\/users/(.+)$ http://www.example.com/profiles/$1 Edit Found a…
macek
  • 6,525
9
votes
7 answers

Password-protect a directory, but not that directory's files?

I was just wondering if it was possible to protect a directory with a username/password combination using .htaccess and .htpasswd files, but not protect the files within. i.e. One is able to link, say, images within that directory to friends, but…
user38597
8
votes
2 answers

How can I highlight .htaccess code in Notepad++?

How can I highlight .htaccess code? I downloaded this XML file and I copy and pasted file content to userDefinedLanguage.xml inside my install directory. According to the documentation found here I need to do the following: "You get the tool for…
InBug
  • 125
8
votes
4 answers

How to show .htaccess files in specific folder in the Finder

I need to see my .htaccess files for the websites i develop locally on my Mac OS X. I put all my sites in the Sites folder. Since it starts with a dot, Mac OS X treats them as system - therefore invisible - files. I'm aware that you can tell Mac OS…
pixeline
  • 353
8
votes
1 answer

pcfg_openfile: unable to check htaccess file, ensure it is readable

After moving a website folder on my local development machine to another drive, then moving it back, I got a 403 error. Most of this problem had probably to do with rights that got messed up. After deleting the code and restoring it from SVN, the…
SPRBRN
  • 8,149
7
votes
2 answers

Using .htaccess with IIS

It is necessary for me to make it possible for .htaccess files to be usable with IIS. Is there a way for this to be done? I know that on its own, IIS is not capable of handling this, but could I perhaps install some third party application that…
6
votes
1 answer

configuring cgi-bin using .htaccess

I'm trying to configure a directory as cgi-bin using .htaccess, but when I try to access the executables, the files are downloaded. I'm using apache2.2. What is the problem? My .htaccess looks like: # cat www/cgi-bin/.htaccess Options…
Alexandru
  • 355
5
votes
2 answers

Redirect all HTTP traffic to HTTPS including subdomains

I'm trying to redirect all HTTP traffic to HTTPS including subdomains. I have the domain setup with FastComet on their Shared Hosting using cPanel. Some examples of how I like to redirect. http://www.example.com -> …
g3blv
  • 279
4
votes
0 answers

why Safari always GET status 200, never 304 for my .swf file?

I serve a Flash app as a .swf file (with HTML wrapper file), and Safari always retrieves with GET status = 200, never 304. Thus, Safari never uses cache for this file and downloads it each time (it's a big file). When I inspect Safari's cache, it…
ggkmath
  • 141
3
votes
1 answer

Proper Apache redirection from http to https

I set up a new virtual host for a new site on my server, but it's acting strangely despite having the exact same settings as my original site. I want all requests to be redirected to HTTPS, simply put. On my main site (the working one) I have this…
vaindil
  • 1,369
3
votes
1 answer

how to redirect a url with port via htaccess

Im Trying to Redirect a Single url like http://tracker.niresh.co:12495/announce to http://tracker.niresh.co/announce.php How can i get it working through htaccess ?
Niresh
  • 233
3
votes
2 answers

How to hide the PHP file extension using WampServer and .htacess file?

I just installed WampServer on Windows7 and uncommented mod_rewrite and set AllowOverride to All in the httpd.config file. I created an .htacess file and placed it in the root folder with the following statement: options…
Fawadafr
  • 31
  • 2
  • 4
1
2 3
10 11