Hot answers tagged .htaccess
So can I achieve this: When I go to: www.websitename.com/data/ it should give an 404 error. And when do www.websitename.com/data/welcome.php it should work. You can simply rewrite every request to a 404 not found status with an exception to welcome.php. In the code below you will see that every rule gets rewritten tot a 404 status with the exception ...
Keep in mind that this'll redirect every request to blog.example.com since it's just capturing anything after the slash and redirecting, so please clarify if you need it to be smarter, but.. RedirectMatch 301 ^/(.*)$ http://example.com/2014/$1
I think what you want is Alias /other-system /httpdocs/other-system See Alias. In .htaccess, instead you can use RewriteEngine on RewriteRule ^/other-system/(.*) /httpdocs/other-system/$1 [QSA]
Don't point at an external url Apache's docs say: The syntax is, ErrorDocument <3-digit-code> <action> where the action can be, Text to be displayed. Wrap the text with quotes ("). An external URL to redirect to. A local URL to redirect to. Pointing at an external url will cause an actual redirect, whereas using a ...
You should try to use absolute or relative path and not an URL My apache2.conf : ErrorDocument 403 /error/403.html ErrorDocument 404 /error/404.html ErrorDocument 500 /error/500.html
First of all .htaccess files are intended to have effect in the directory they're placed, so rather than having one in /var/www/ typically you would have two: one in each of /var/www/impdata/ and /var/www/data/ Or rather have no .htaccess files at all: my pet peeve, quoted from from the manual on .htaccess files: You should avoid using .htaccess files ...
You need logical OR, e.g. (condition1|condition2|conditionN) RewriteRule ^((?!(index\.php|bio\.php|contact\.php)[^/]+)/?$ galeria.php?nome=$1 [L,QSA,NC]
Only top voted, non community-wiki answers of a minimum length are eligible