Rewrite URL after redirecting 404 error htaccess

Try this in your .htaccess: .htaccess ErrorDocument 404 http://example.com/404/ ErrorDocument 500 http://example.com/500/ # or map them to one error document: # ErrorDocument 404 /pages/errors/error_redirect.php # ErrorDocument 500 /pages/errors/error_redirect.php RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/404/$ RewriteRule ^(.*)$ /pages/errors/404.php [L] RewriteCond %{REQUEST_URI} ^/500/$ RewriteRule ^(.*)$ /pages/errors/500.php [L] # or map them to one error document: #RewriteCond … Read more

robots.txt and .htaccess syntax highlight

Use Package Control to install the syntax packages you want to use. If you’re using Sublime Text without Package Control, you’re missing out on a lot. Install Package Control (follow the linked instructions) After restarting, type Command+Shift+P then Install Package Install ApacheConf and the Robot Framework you mentioned Packages can be added and removed very … Read more

.htaccess / .htpasswd bypass if at a certain IP address

For versions 2.2.X you can use the following… AuthUserFile /var/www/mysite/.htpasswd AuthName “Please Log In” AuthType Basic require valid-user Order allow,deny Allow from xxx.xxx.xxx.xxx satisfy any Obviously replace the path to your usersfile and the ip address which you would like to bypass the authentication. Further explanation of the specifics, can be found at: http://httpd.apache.org/docs/2.2/howto/auth.html

urlencoded Forward slash is breaking URL

Apache denies all URLs with %2F in the path part, for security reasons: scripts can’t normally (ie. without rewriting) tell the difference between %2F and / due to the PATH_INFO environment variable being automatically URL-decoded (which is stupid, but a long-standing part of the CGI specification so there’s nothing can be done about it). You … Read more