6
votes
D8 doesn't create .htaccess for private file system path
This is a better .htaccess to use:
# Turn off all options we don't need.
Options -Indexes -ExecCGI -Includes -MultiViews
# Set the catch-all handler to prevent scripts from being executed.
SetHandler ...
5
votes
How to prevent executing .php files in sites/default/files directory for nginx+php7.0-fpm?
This is what works for nginx and only targets files directory:
location ~ /files/.*\.php$ {
return 403;
}
This is more generic and wont let any php file in a directory execute directly:
...
5
votes
Accepted
Getting error 'Redirects to external URLs are not allowed by default'
If you still haven't figured this out, check this comment on d.o: https://www.drupal.org/project/drupal/issues/2612160#comment-11767977
It suggests a workaround by removing the subdir from the script ...
5
votes
Accepted
How are clean URLs with 200 response codes being managed without doing a RewriteMap?
The Apache mod rewrite module is used. /some/path is rewritten internally by Apache to index.php?q=some/path [Credit: mpdonadio].
index.php bootstraps Drupal. Drupal determines if it is able to ...
3
votes
Two sites on the same server don't work
Check both site's .htaccess files and find the lines where it says RewriteBase etc.
Your first site's .htaccess needs:
# If your site is running in a VirtualDocumentRoot at http://example.com/,
#...
3
votes
Accepted
Why are there .htaccess and php files in ./sites/default/php/twig
The PHP files are compiled Twig templates and the .htaccess file protects them from public access. You can switch off the caching of compiled twig templates by setting this service parameter to FALSE.
...
3
votes
Accepted
After migration, impossible to logging from the remote server, error 'You are not authorized to access this page"
According to kingfisher64 in "Access denied" "you are not authorized to access this page" error ???
Just in case somebody stumbles over this issue the solution for me was
in settings.php. I had ...
3
votes
Create a general rewrite rule in .htaccess
I think your rewrite collides with the other rewrites in drupal standard .htaccess. Try a redirect. The redirect will be executed right away and the rest of .htaccess will no longer be processed. And ...
3
votes
Accepted
Google Page Speed Insights recommends Leverage browser caching
As these files ain't located on your server you can't do anything about it except wondering why Google Page Speed isn't smart enough to distinguish between on-site resources and external resources. Or ...
3
votes
How do I redirect a domain but keep the URL structure?
Your second variant is close to the goal. But it needs some edits. Firstly, you should escape all dots in RewriteCond, so it will be
RewriteCond %{HTTP_HOST} ^example\.co\.uk$ [NC]
Secondly you need ...
3
votes
Accepted
Patching docroot htaccess: file not found
Look your patch already has the path to web/ in it:
--- a/web/.htaccess
+++ b/web/.htaccess
Just remove the cd web && and adjust the path to the patch accordingly.
"post-drupal-scaffold-...
3
votes
How to restrict access to specific php file to only athenticated users
.htaccess won't help with this; Apache doesn't know what an authenticated Drupal user is, and there's no easy way to grant it that knowledge. Fortunately there's a much better option:
Create a route ...
3
votes
Accepted
How do I avoid overwriting the .htaccess file when I use the Compose command?
Both .htaccess and robots.txt are a part of Drupal core, they are called "Scaffold Files". When you do composer update it will download the repository version of these files.
You have to re-...
3
votes
Accepted
Website doesn't load properly from htdocs/web
This is very limited shared-hosting, no control panel and no way to
edit apache's configs, only .htacess files accessible in htdocs
Look for a new hosting company, until then you can use the legacy ...
2
votes
Accepted
How to fix my Rewriterule in .htaccess to transparently redirect any domain alias?
This worked: I had to use the ?q= inside the last rewriterule like this:
RewriteRule ^/?$ ?q=landingpage/%1-%2 [L]
2
votes
Where is the .htaccess file?
I executed the command you quoted, and I got the following files. (I executed ls -alF in the directory where Drupal 8.3.0 was copied from Drush.)
-rw-rw-rw- 1 kiamlaluno kiamlaluno 262 Apr 6 02:...
2
votes
Accepted
Where is the .htaccess file?
If you download Drupal from here, there is the .htaccess file in main directory.
How do you downloaded Drupal source code?
2
votes
Two sites on the same server don't work
As said previously, check your HTACCESS on both sites, and your apache virtual host. In theory, you can imbricate websites... But it's not recommended and not easily maintainable.
But the simpler and ...
2
votes
redirect whole site to HTTPS
The example from @rjkunde didn't work on my local Lando based drupal development environment, the browser gave me the error message: "The page isn’t redirecting properly". The drupal ...
2
votes
Create a general rewrite rule in .htaccess
Rewrites this code for your problem in .htaccess. The code will work for any string in between reading_ and .html
RewriteEngine On
RewriteRule ^reading_(.*)\.html$ http://www.server.com/reading/$...
2
votes
Two sites on the same server don't work
First of all: You might want to check the logs: both sites logs + server logs + db logs. There got to be some error code somewhere.
Here's a list of things you can try:
Use different admin users ...
2
votes
Serving Drupal from within a sub-directory of my web root
You have to edit the nginx virtual host file of your website.
You'll usually find it at /etc/nginx/sites-available/yoursitename.vhost.
Open it with write permissions, and edit root directive at the ...
2
votes
Accepted
.htaccess rewrite doesn't work
The rewrite rule will not work because page is not a valid path on the server. By default Drupal rewrites all requests into index.php. When you rewrite to page apache will expect a path page on the ...
2
votes
Accepted
Install using Composer doesn't create .htaccess file
Both drupal-composer/drupal-project and drupal/recommended-project create Drupal installations with a relocated DOCROOT, or web root. So, the .htaccess folder isn't in the root of the installation.
...
2
votes
Accepted
('text/plain') is not a supported stylesheet MIME type
If the CSS files are in the private files directory this is not an Apache issue. Drupal controls access and serves the files via PHP. Normally files stored in the private directory are managed and the ...
2
votes
Accepted
How can I add custom code to Drupals .htaccess and make sure it will stay there
Patching scaffolded files is documented precisely.
"name": "my/project",
...
"scripts": {
"post-drupal-scaffold-cmd": [
"cd docroot &&...
1
vote
Problem creating redirect from page with %20
If you are using the Redirect module it has an admin page for fixing 404 errors with redirects. Your file should be listed there since it gives you a 404 error.
When clicked on "Add redirect" action ...
1
vote
Locked out of the site, and new users can't get in
For a while it seemed that adding localhost to the Trusted Host settings in settings php did some good, then I realized it didn't so I removed it, leaving just the lines below:
$settings['...
1
vote
404 on index.php?q=admin
I encountered this problem on a localhost install of Drupal 8 on Ubuntu18.04.
I could see the base url page but every link into my site was 404 (e.g. any link from the admin bar).
Clean URLs
I ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
.htaccess × 2997 × 75
redirection × 41
uri × 38
8 × 37
files × 25
multi-sites × 19
media × 14
ssl × 13
6 × 12
users × 11
configuration × 9
security × 9
caching × 8
subsites × 8
migrations × 7
path-aliases × 6
installation × 6
composer × 6
domain-access × 5
theming × 4
nodes × 3
i18n-l10n × 3
updating × 3
http-request × 3