New answers tagged

1 vote

.htaccess Wildcard Passthrough Redirect

RewriteRule ^(.*)$ https://example.com/%1 [L,R=302] Currently, you are capturing the URL-path (ie. ^(.*)$) but not making use of this, so any requests for files are redirected back to the "...
user avatar
  • 41.2k
0 votes
Accepted

Rules in .htaccess only if the requested URL is /wp-admin

I ended up with this solution. I think in my first try my regex was wrong. <If "%{REQUEST_URI} =~ m#^/wp-admin/#"> </If> <Else> Header add Content-Security-Policy &...
user avatar
2 votes

Hide subfolders in URL with .htaccess

This assumes you have already changed all the internal links on your site to be of the form /this/index.php (or /this/<something>?), ie. #3 in @Stephen's comment above. For your specific example,...
user avatar
  • 41.2k
2 votes

Rewrite three URL directories to corresponding PHP files and pass subdirectory as a parameter

RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule ^(download-file)/([^/]+)$ https://example.com/download-file?name=$2 [L] By using an absolute URL (with scheme + hostname) in the substitution ...
user avatar
  • 41.2k
3 votes

Rules in .htaccess only if the requested URL is /wp-admin

Try something like this instead: <If "%{THE_REQUEST} !~ m#\s/wp-admin#"> Header add Content-Security-Policy "default-src 'self';" Header add Content-Security-Policy "...
user avatar
  • 41.2k

Top 50 recent answers are included