Hot answers tagged htaccess
6
This is no doubt dependent on your remaining 200+ lines, but what you have posted so far would seem to be reducible to just 2 lines:
RewriteRule ^patients/billing/(FAQ_billing|getintouch).html$ $1.php [L,NC]
RewriteRule ^patients/findadoctor/([a-z]).html$ findadoctor.php?id=$1 [L,NC]
This shouldn't be reducing your site to a crawl.
As mentioned in ...
3
Very simple. Just create another .htaccess file in the /subsite directory, and set your ErrorDocument 404 in it to the subsite's 404 page, ie ErrorDocument 404 http://example.com/subfolder/alternate-404.html. The .htaccess in the parent folder will still be used for the main document root, and all other subfolders.
2
This is normal for dynamic pages. An ETag is a unique identifier for that version of a particular file. The web server can automatically set ETags for static files (html, css etc.), because it can work out when their contents were last changed by looking at the file's last modified time (and some other attributes). There's no way for the web server to know ...
1
I replicated your setup. There are two problems:
I can't get the %20 in the rewrite URL to work. I can get the rule to work if I replace %20 with +. A plus sign should URL decode to a space the same way a %20 does, so it should be treated the same in your matchevent.php script.
It was redirecting me to a bad relative path. If I change the redirect path ...
1
This isn't really a property of .htaccess files, but of Apache configuration directives in general - many directives being applied in a <Directory> or <Location> block will apply to child directories, and .htaccess files are essentially another way to configure <Directory> blocks.
If you had control over where the subdomains were in the ...
1
Assuming this is in the .htaccess in your document root, then you are almost there. You just seem to be missing the / (slash - directory separator) from the front of your destination URL (in the first example).
RewriteEngine On
RewriteRule ^somepage$ /abc/somepage.php [R=301,L]
The slash (or whatever is the base URL) is automatically removed from the ...
1
The htaccess does, by definition, slow down your site because the server must check every folder for the file - e.g. in your case the folders /patients/findadoctor/, /patients/ and the root folder. It is more efficient to write those rules in the server config itself, then set AllowOverride None, which will stop Apache looking for htaccess files. If you are ...
1
If your webserver is apache, you can use the technique from here: http://stackoverflow.com/questions/6059920/removing-index-html-from-url-and-adding-www-with-one-single-301-redirect
In order to remove index.html or index.htm from URLs I use the following in my .htaccess
RewriteCond %{REQUEST_URI} /index\.html?$ [NC]
RewriteRule ^(.*)index\.html?$ "/$1" ...
Only top voted, non community-wiki answers of a minimum length are eligible

