New answers tagged .htaccess
0
votes
Using htaccess in Apache to block query string input
You are implementing a kind of web application firewall, using RewriteRules is rather limited. I'd recommend using mod_security and an existing ruleset.
0
votes
Accepted
Redirect to folder only if root from other site referrer
Here is my .htaccess:
RedirectMatch ^/$ https://example.com/
This obviously doesn't redirect to /subfolder as you suggest. It would create an endless redirect loop.
However, you can't check the ...
1
vote
Accepted
Redirect to other server and domain if file not found
I got the solution after modifying @Rob answer.
set $v_filename nf;
location ~ ^/data/(.*)$ {
try_files $uri @externalbackup;
set $v_filename $1;
}
location @externalbackup {
return ...
1
vote
Redirect to other server and domain if file not found
In nginx you would use a try_files directive, which serves the content from a local file, if it exists in one (or more) local directories. When no file is found, an internal redirect to the uri ...
0
votes
.htaccess redirect sub-folders to the correspondent index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.+)/.*$ $1/index.php [L,QSA]
I've found the answer , with this rule every folder is redirected to ...
0
votes
.htaccess redirect sub-folders to the correspondent index.php
You just need to make sure that DirectoryIndex is set correctly in the root .htaccess file. (This defaults to index.html, although many distros include index.php as well, so you often don't need to do ...
0
votes
Redirect all pages to non www and one page to www
I searched many articles on the internet but it could not work.
Probably because this is a strange requirement. I would be surprised if you could find any code that you could simply copy/paste that ...
0
votes
Accepted
Forbidden ... denying access to be safe
Forgot to mention, as part of my setup, I was booting from usb, rather than the built in sd.
For my backup, I had an additional drive plugged into the second usb. However, I hadn't actually set up the ...
Top 50 recent answers are included
Related Tags
.htaccess × 2724apache-2.2 × 1097
mod-rewrite × 674
apache-2.4 × 349
redirect × 316
rewrite × 303
php × 204
nginx × 128
wordpress × 127
apache2 × 118
linux × 112
301-redirect × 110
virtualhost × 72
https × 71
subdomain × 65
rewritecond × 55
security × 53
regex × 52
ubuntu × 48
ssl × 47
httpd.conf × 45
web-server × 37
.htpasswd × 36
url × 35
httpd × 34