We are using the Redirect module 8.x-1.2 with Drupal 8.5.6. When generating URLs, we are finding that a trailing slash is added to the end of the URL, and this is creating a 503 error code.

How would I redirect the anonymous users from the URL with the trailing slash to the one without trailing slash?

3 Answers 3


Check your .htaccess file in root. There maybe a line that is overriding this rule. Check if this is in your .htaccess file, this forces a trailing slash.

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /(.*)/$
RewriteRule ^ /%1 [R=301,L] 

To remove the trailing slash use

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R]

If the Drupal setting is not being enforced then you may have a rule in your .htaccess file that is adding a slash. @usernameabc Try adding the last 2 lines under RewriteEngine on

  • @Dupls is there something specific I should look for? Commented Oct 4, 2018 at 23:24
  • i was not able to find those lines. Commented Oct 16, 2018 at 23:57
  • Did you try and first remove the .htaccess entirely rename the file to bk.htaccess and see if it changes anything. If it does then rename the file back to .htaccess and try ADDING the last two lines after RewriteEngine. Another perhaps silly thing to ask, do you have the redirect module installed that has some setting? Or a page redirect with the slash? Lastly check your domain if you have the slash entered there.
    – Dupls
    Commented Oct 17, 2018 at 0:14
  • Excellent @usernameabc
    – Dupls
    Commented Oct 21, 2018 at 22:02
  • we had to modify a rewrite rule had and your answer led to the solution. Commented Oct 22, 2018 at 20:10

Select the Enforce clean and canonical URLs checkbox in admin/config/search/redirect/settings.

Enabling this will automatically redirect to the canonical URL of any page. That includes redirecting to an alias if existing, removing trailing slashes, ensure the language prefix is set and similar clean-up.


  • even after changing to these settings, we still experience the issue. Any other thoughts? Commented Oct 3, 2018 at 17:16
  • I tested it works for me, clear cache and retry!
    – berramou
    Commented Oct 3, 2018 at 17:22
  • I did retry and same results, i am still investigating to see if it is something in htaccess... Commented Oct 4, 2018 at 23:23
  • I was able to confirm the setting you have is what we have and htaccess does not have any lines. Commented Oct 16, 2018 at 23:58

In my case, whenever I accessed a url, four slashes were automatically appended to the url (IP////<node_name).

Following steps resolved my issue:

  1. Ensure that following entry is available in Apche configuration file - httpd.conf. LoadModule rewrite_module modules/mod_rewrite.so
  2. Create a php file test.php with the following code. <?php echo phpinfo(); ?>
  3. Open test.php in your browser. Check the Loaded Modules section to ensure that mod_rewrite is available.
  4. Also open the root Drupal PIP folder and ensure that .htaccess folder is there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.