Bobcares

Drupal htaccess Redirect Not Working | Troubleshooting Methods

by | Dec 25, 2022

Let’s fix the “htaccess redirect not working” issue in Drupal in this article. At Bobcares, with our Server Management Services, we can handle your server-related problems.

How to fix the “htaccess redirect not working” issue in Drupal?

 

drupal htaccess redirect not working

Method 1

Set the RewriteBase: The site URL, for e.g, http://example.com/~bobcares/drupal/is in a subdirectory, we need to set the RewriteBase. In order to do so, locate the below part in the .htaccess file:

# Modify the RewriteBase if we are using Drupal in a subdirectory and
# the rewrite rules aren't working properly.
#RewriteBase /drupal

Here, we need to modify the last line as given below:

 RewriteBase /~bobcares/drupal

When we use an Alias, the URL looks like http://example.com/YourAliasName/, then we need to change the last line like the above: RewriteBase /YourAliasName.

Method 2

Ensure the .htaccess file and Drupal are uploaded to the same directory: We must upload the .htaccess file properly. In case, if it is deleted, then we need to install Drupal again and then copy the new .htaccess file. We must also make sure the file only contains .htaccess.

Method 3

Ensure the file is not corrupted: The file works properly only when things are in order. With password protection or block image hotlinking, the .htaccess file has the chance to get corrupted. The solution to fix the issue is by removing the corrupted file. Then upload the standard file that is available with Drupal.

Method 4

Ensure to not change the Apache rewrite rule: By default, the rule will be RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]. This rule will convert a path like example.com/node into example.com/index.php?q=node.

So we’ll expect example.com/node?page=1 will be example.com/index.php?q=node?page=1. However, it fails as both the separators here are “?”. So the ReWriteRule keeps any current arguments after the rewrite by changing the second ‘?’ in this scenario into ‘&’.

[Searching for the solution to a different question? Simply click here to reach us.]

Conclusion

The article provides four different troubleshooting methods from our Support team to fix the “htaccess redirect not working” issue in Drupal.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.