New answers tagged

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.
user avatar
  • 9,137
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 ...
user avatar
  • 11.4k
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 ...
user avatar
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 ...
user avatar
  • 653
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 ...
user avatar
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 ...
user avatar
  • 11.4k
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 ...
user avatar
  • 11.4k
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 ...
user avatar
  • 11

Top 50 recent answers are included