Questions tagged [.htaccess]

Directory-level configuration file found mostly on Apache web servers

The htaccess file is a supplemental configuration file used by Apache to modify the default configuration as it applies to the directory the htaccess file it in (as well as all the files and subdirectories in that directory).

You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance.
Source: Apache manual

The directives allowed in htaccess files are governed from the main Apache configuration files by means of the AllowOverride directive.

The most common use is in conjunction with the mod_rewrite and security modules of the Apache webserver. Mod_rewrite allows URLs to be rewritten for scenarios such as the following:

  • Shortcuts such as example.com/info to redirect to another page
  • Redirects from old pages to new pages
  • virtual directories (directories which actually appear elsewhere in the file system)

The most common security applications are:

  • Password protection of directories and files

For more information see the mod_rewrite and aaa documentation.

2807 questions
1
vote
1 answer

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/ in conjuction with the necessary .htaccess code…
1
vote
1 answer

Htaccess problems when coming from a truecrypt container

I was messing with one of my sites' .htaccess files and got it working as desired. Then I was finished working on it so I moved it to my encrypted container (TrueCrypt). Later on I wanted to change some things so was modifying the .htaccess…
bMon
  • 253
  • 1
  • 9
1
vote
2 answers

Redirect FROM cgi-bin to home page

We are currently building on a domain that was previously used by someone else. We have managed to 301 redirect everything except for one page: http://www.mysite.com/cgi-bin/link.cgi I have tried redirecting everything from the cgi-bin directory…
Jon
  • 11
  • 2
1
vote
2 answers

Protecting PHP packages on server

I am a php developer and have recently decided to make one of my Magento extensions commercial. I have downloaded and configured MageParts CEM Server and that is all working perfectly in regard to licencing and delivery of module packages. The only…
Jack
  • 25
  • 2
  • 5
1
vote
3 answers

Request exceeded the limit of 10

My logs are FULL of [Tue Jan 11 10:20:45 2011] [error] [client 99.162.115.123] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel…
Ben
  • 3,800
  • 18
  • 65
  • 96
1
vote
2 answers

Wildcard subdomain setup ... want to change host IP throws off client A records... what to do

Here is the current set up (in a nutshell). The site is set up with a wildcard subdomain, so *.website.com is accessible. Clients can then domain map their own domains with an A record to the server IP address and it will translate the to…
Joe
  • 13
  • 2
1
vote
2 answers

Can you see something wrong in my .htaccess?

I've managed to create an .htaccess file that does what I wanted (see explanations and questions after the code block): RewriteEngine On #1 If the requested file is not url-mapper.php (to avoid .htaccess loop) RewriteCond…
AlexV
  • 179
  • 1
  • 2
  • 16
1
vote
3 answers

mod_ReWrite to remove part of a URL

Someone has incorrectly linked to some of my urls causing 404 erros in Google Webmaster Tools. Here is an example Linked URL: http://www.example.com/foo-%E2%80%8Bbar.html Correct URL: http://www.example.com/foor-bar.html I would like to 301 redirect…
Jack
  • 25
  • 2
  • 5
1
vote
2 answers

Problems restricting access using Apache

I've set up XAMPP on a Windows 7 machine, and I want to restrict access to the htdocs folder to only requests from the local machine. C:\Xampp\htdocs is the web root folder. I have the following in my apache/conf/httpd.conf file:
Tola Odejayi
  • 334
  • 1
  • 4
  • 19
1
vote
4 answers

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 var/www/vhosts/www.example.com/conf/vhost.conf. And I put: ServerAlias…
1
vote
1 answer

turning urls into subdomains?

i have this url http://www.example.com/user.php?user=solomon i want to convert this into http://solomon.example.com how can i do this!! thanks :)) p.s. im using plesk
Solomon Saleh
  • 193
  • 2
  • 9
1
vote
1 answer

performance wise htaccess

hese's the my htaccess template, i wonder if anything could be added to increase website performance.. # Defaults AddDefaultCharset UTF-8 DefaultLanguage en-US ServerSignature Off FileETag None Header unset ETag Options -MultiViews #Options All…
dzhi
  • 800
  • 3
  • 10
  • 26
1
vote
1 answer

Need help with an .htaccess URL rewriter

I'm trying to do another SEO system with PHP/.htaccess... I need the following rules to apply: Must catch all URLs that do not end with an extension (www.foo.com --> catch | www.foo.com/catch-me --> catch | www.foo.com/dont-catch.me --> don't…
AlexV
  • 179
  • 1
  • 2
  • 16
1
vote
2 answers

.htaccess configuration issue

I am using two website on one domain like: www.example.com & www.example.com/site2. I want to know that on my site2, in my site2 their are 2 folders name folder1 and folder2 my index.php is in folder2 but the definition of methods defined in folder2…
1
vote
2 answers

Lazy Conditional Rule not doing anything! Why?

I am rewriting php generated thumbnails with igly urls into nice ones. instead of img.php?src=bla.jpg&w=200&h=100 the static filenames IMG-file_w200_h100.jpg Because the rewrite is so complex and involves many variations, only urls starting with…
Sam
  • 423
  • 3
  • 7
  • 23