Skip to main content

Questions tagged [.htaccess]

Use it for questions about the configuration file used from the Apache server, the .htaccess file.

Filter by
Sorted by
Tagged with
0 votes
1 answer
702 views

Can't install modules from UI when site placed in subdirectory

I have Drupal 8 installed in a subfolder (www.example.com/drupal), and I have my root .htaccess configured to mask the subfolder (i.e. the URLs resolve to www.example.com; /drupal does not appear in ...
-1 votes
3 answers
129 views

.htaccess file under sites/default/files/ stops css from loading

I'm working on a new installation of Drupal 10.2 and I noticed there's an .htaccess file in the files folder. This file is created automatically by Drupal. When I try to delete it, it gets created ...
0 votes
3 answers
2k views

How to set and use direct files folder path in a multisite installation

Drupal 8 multisite install where First site is on a subdomain one.example.com Second site is in a subfolder one.example.com/two How can files folder for both sites to be accessible via URL/files ...
0 votes
1 answer
412 views

Front page returns 403 for unauthorized users

I'm trying to get a D7 staging site's git repo up-to-date with its production server repo. In other words, I changed A LOT of stuff on staging (by running git fetch <branch> && git reset ...
2 votes
1 answer
469 views

Call to undefined function menu_load() in .../public_html/includes/menu.inc on line 579

I really need your help. Actually, my journey begin with the installation Drupal and some modules. After a couple of days I suddenly get an issue "500 Internal Server Error". I asked my hosting ...
1 vote
0 answers
46 views

How can I deny all URLs that end with .php? [closed]

I have the following .htaccess lines that only allows to visit index.php and disallows access to install.php, update.php and all other PHP files. <IfModule mod_rewrite.c> RewriteEngine on ...
0 votes
2 answers
2k views

RewriteRule causing internal redirect limit error

I am trying to server a static HTML site from /sites/default/files/staticsite and make it available via a subdomain. I'm hosting the site on Acquia Cloud, and their docs describe Maintaining a static ...
0 votes
1 answer
401 views

The clean URL test failed. (ubuntu14.04 lts + virtualmin + Apache/2.4.7)

i can't enable clean url. Mod_rewrite is already enabled. Anything i'm missing? here is the conf my apache is running user mode, the document root is in /home/drupal/public_html /etc/apache2/sites-...
1 vote
1 answer
476 views

Locked out of the site, and new users can't get in

I have an odd problem. My new Drupal 8 site is a distro, purchased from ThemeForest. After installing it, I thought I created a new user correctly but maybe the name had disallowed characters. In any ...
1 vote
1 answer
512 views

Hide url in subdirectory install?

in my site I use version 7 of Drupal and Linux OS on the server, and need to hide the subdirectory of the installation when access by LINK ... explaining better: Current link: www.site.com/folder I ...
0 votes
1 answer
453 views

HTTPS with and without www

I have drupal 8 based website implemented. global $base_url; is used in two different modules. Module-1: $content .= $base_url .'/user/role/1'; it gives the URL pattern as: https://www.example.com/...
1 vote
1 answer
838 views

How to eliminate direct access to files in private directory?

I have set up my Drupal 7 site for private files in a directory above root (../private). I also set my filefield on my node type to upload the image files to that private directory. I have two user ...
0 votes
1 answer
599 views

Upgrading to 7.26 - Internal Server Error

I recently upgraded from Drupal 7.25 to 7.26 in maintenance mode. The upgrading did not have any errors. Now when I go to the homepage I get an Internal Server Error. I added an echo statement to ...
1 vote
1 answer
379 views

Alternative to .htaccess compression with Boost

My hosting provider doesn't support mod_deflate directives in .htaccess to provide compressed HTTP responses. I am using Drupal 7 with Boost and wish to compress HTML, CSS and JS responses. Is there ...
0 votes
1 answer
41 views

I can't access the login page

I have a backup of a site built with Drupal 7.60. I was able to complete the installation on my local machine, but I could not access http://localhost/showbizz-plaza/?q=user nor http://localhost/...
0 votes
1 answer
113 views

Website doesn't load properly from htdocs/web

Built a website on localhost, moved it to shared-hosting where webroot is htdocs but when visiting the website through the hosting's given IP address it obviously doesn't load the website, because the ...
2 votes
2 answers
5k views

Getting error 'Redirects to external URLs are not allowed by default'

Getting the error after created this .htacces in root folder. RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/web RewriteRule ^(.*)$ /web/ I want to redirect visitors to /web folder. I ...
4 votes
2 answers
7k views

Index.php prompts to download instead of executing

I am running into a issue where I am trying to load up my Drupal site, but instead of going to the main page, it instead prompts to download / save the file. I know that my PHP is active and I can't ...
1 vote
0 answers
192 views

RewriteBase and Administer software updates permission not working

User 1 is unable to run /update.php, with the error: In order to run update.php you need to either have "Administer software updates" permission or have set $settings['update_free_access'] ...
0 votes
1 answer
280 views

How can I add custom code to Drupals .htaccess and make sure it will stay there [duplicate]

For one of my Drupal 9 website I need to add a custom code to the htaccess file to redirect the visitors from one subdomain to another for this I use the following code: #Custom Rewrite Rule ...
0 votes
1 answer
302 views

redirection in htaccess file

I'm working on Drupal7. I want to redirect all the URl's to external domain except some. Below rewrite I have added in .htaccess file and its working fine. RewriteCond %{REQUEST_URI} !/user.*$ ...
0 votes
1 answer
2k views

Blank screen with no error messages on new server

I have a working Drupal 7 site, built with git, running on 2 different servers, one test server and one server used for staging and production sites. So I know that the site is working. So after ...
2 votes
5 answers
876 views

What is good way to hide update.php file?

I will like to know what is the correct/better way to hide update.php file on the production server. Currently when you try to access update.php file, Drupal shows default access denied page with ...
1 vote
0 answers
164 views

Htaccess 301 redirects after switching language detection method

We have a multilingual Drupal installation with a domain for each language. Like this: domainexample.com domainexample.no domainexample.de etc... We want to switch to a single domain and use domain ...
3 votes
2 answers
7k views

Rewrite URL not working

In Drupal 6 I used the following snippet of code in my .htaccess file to extract information from a non-existent URL and pass it to an existing URL in a GET form. However, it isn't rewriting the URL ...
1 vote
0 answers
166 views

How does SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006 work exactly?

I ran into an issue (When using fpm, it is not clear how to make image styles work ) which I traced back to the use of Drupal_Security_Do_Not_Remove_See_SA_2006_006 in sites/default/files/.htaccess. ...
0 votes
1 answer
26 views

Actual file permisions

With Drupal 8/9 I want to: Have a private file folder Upload files to it (ideally by whatever method but media type will do) Allow only authenticated users (ideally set by role) to view the file (...
1 vote
1 answer
2k views

('text/plain') is not a supported stylesheet MIME type

We just upgraded from Drupal 8 to Drupal 9, and now we have some css files not working in Chrome due to the below error. Refused to apply style from '' because its MIME type ('text/plain') is not a ...
3 votes
2 answers
5k views

D8 doesn't create .htaccess for private file system path

Following this guide: https://www.drupal.org/documentation/modules/file it says "When you specify the private directory in admin/config/media/file-system it will automatically create the sub-...
0 votes
1 answer
160 views

Links don't work on the production server after moving from the development server

I have moved my Drupal site from localhost to live server but all links and contents are not access able and it gives: 404 Not Found error was encountered while trying to use an ErrorDocument to ...
2 votes
2 answers
326 views

Rdirected site folder doesn't work

My web host directs traffic to the main public_html folder on the site for my main site. However, I want my main site to redirect to a subfolder for organizational reasons, so I can easily manage just ...
3 votes
2 answers
928 views

What is the proper process to customize htaccess files?

We have custom redirect links that use the RedirectMatch rules that redirect based on a root path. We'd rather handle these at the web server level rather than using the Redirect module (if it can ...
7 votes
3 answers
9k views

How to prevent executing .php files in sites/default/files directory for nginx+php7.0-fpm?

URL to Drupal.org article Preventing execution of untrusted PHP By default .htaccess inside sites/default/files contains: <IfModule mod_php5.c> php_flag engine off </IfModule> Adding ...
2 votes
2 answers
563 views

How to redirect all images in the files folder to a default file?

Because we work with DTAP environments, our developers work on their own laptops. To get a good view of the live environment, we copy the PROD database and the files to our own laptop. However, this ...
2 votes
1 answer
1k views

How to add image cache headers?

When doing SEO tests, we consistently seeing a message for cache headers on images. We were thinking of implementing but cannot find the appropriate way to test this as the x-cache still gives a MISS. ...
1 vote
1 answer
1k views

How do I avoid overwriting the .htaccess file when I use the Compose command?

On my new Drupal 9 website, I customized the .htaccess file and the robots.txt file I don't want its files to be overwritten when updating with Composer. I added the lines below in my composer.json ...
0 votes
0 answers
746 views

Redirect to web folder

I'm trying to configure redirects on a Drupal site using Apache web server. I'm trying to implement what described in Remove /web part from a Composer based Drupal site, but I cannot get it to work. I ...
0 votes
1 answer
1k views

Why are all files (except index.php) being redirected to 'index.html'?

We have a Drupal 7 Drupal Commerce site that we've just moved to our virtual private apache server, however we're seeing very strange behaviour that's making the site not work. We're getting a ...
0 votes
1 answer
512 views

How to restrict access to specific php file to only athenticated users

I manually made a php file that has the ability to connect to the database and create table entries, it works fine, but now the problem is that if I leave it there, anyone will be able to access it to ...
-1 votes
2 answers
962 views

404 on index.php?q=admin

I restored my Drupal 7 site from backup and now can't get to the admin page. Getting a Drupal 404 page on example.com/index.php?q=admin as well as example.com/?q=admin. Needless to say admin/ also ...
0 votes
1 answer
331 views

Patching docroot htaccess: file not found

I tried to create my first patch file in order to reverse the overwriting of the scaffold file .htaccess after executing composer install. I get the following errors: can't find file to patch at input ...
0 votes
0 answers
129 views

Conditional .htaccess rule for multisite sitemap.xml

We have multiple sites hosted with Domain access module. I was planning to host sitemap.xml files like web_root/zyx.com/sitemap.xml and web_root/abc.com/sitemap.xml. I am using the following code. ...
3 votes
3 answers
10k views

redirect whole site to HTTPS

When I include the snippet found in answer to this question How to simply make the whole site HTTPS? to redirect to https in my htaccess.php file, all urls resove to /index instead of going to the ...
1 vote
1 answer
638 views

How do I redirect a domain but keep the URL structure?

I have example.com and example.co.uk. They both point to the same Drupal installation on my server, so both domains load the exact same site. I am now trying to redirect the .co.uk to the .com domain. ...
0 votes
0 answers
657 views

Prevent spammers accessing my site by blocking their IP address

Story: I have my drupal site hosted in aws. Initially there were so many spam registrations occured. I prevented this completely by google recaptcha. By checking the recent logs in drupal I see the ...
1 vote
1 answer
1k views

Why is my .htaccess not working when uploaded to a Pantheon server?

My drupal site has a .htaccess file on which I am redirecting the page without changing the URL. It's working fine on local server & other servers but when I upload the files & databases to ...
-5 votes
3 answers
1k views

Two sites on the same server don't work

I have a Drupal 8 site installed in a root directory(/var/www/html). I then installed another Drupal 8 site in another folder(/var/www/html/myFolder). The homepage is working fine. If I try to log ...
10 votes
6 answers
4k views

Friendly error page to replace WSOD

This should be the easiest thing to do, but for some reason I just can't get it done. I'm trying to get a friendly static error page to replace nasty 500 scenarios. For now I'm just trying to ...
0 votes
0 answers
63 views

rewrite for single PHP file

I'm asking in this forum because there are some specific Drupal 8 rules that might need to be applied. I am looking for the correct way to add .htaccess rules that allow for: domain.com/specific/ ...
1 vote
0 answers
686 views

Restoring a database breaks clean URLs

I am using Drupal 7 and the Backup & Migrate module to restore (or import) a Drupal installation that works fine on a different computer. When I run the import process everything seems to work ...

1
2 3 4 5 6