Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 512231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:17:55+00:00 2026-05-13T07:17:55+00:00

How do you set a 301 redirect in .htaccess to add the forward slash

  • 0

How do you set a 301 redirect in .htaccess to add the forward slash to your document root if someone links to you without it?

According to the research I have done most search engines consider the following URL’s as two different URL’s.

mydomain.com (no forward slash)

mydomain.com/ (forward slash)

I’ve tried this (plus many others):

RewriteRule ^$ http://www.mydomain.com/ [R=301,L]

That throws it into a loop loading the page over and over.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:17:56+00:00Added an answer on May 13, 2026 at 7:17 am

    I think you drew incorrect conclusions out of your research. For HTTP, the Root-URL without forward slash is specified to be equal to the forward slash:

    Note that the absolute path cannot be empty; if none is present in the original URI, it MUST be given as “/” (the server root). [RFC 2616 Section 5.1.2]

    Hence, if the original URL is only a domain name that does not end with a forward slash (i.e. the absolute path would be empty), that URL will be extended by a forward slash. You don’t have to do anything.

    As for your problem: Due to the subtleies of mod_rewrite, the first slash is ommited, so your RewriteRule captured the root URL and sent the requester in a redirection-loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to set 301 redirect in .htaccess file and here is what i am
I'm attempting to set a 301 redirect in .htaccess The 'dir' is a set
I'm trying to add a simple 301 rule to the .htaccess file of a
IS there a way with just htaccess 301 redirect to redirect any page on
I'm redirecting this URL: http://mydomain.com/expandyourtaste Using this .htaccess file: #Expand your tastes redirects Redirect
Would it be possible to set a 301 redirect for sub.domain.com to redirect to
I set up 301 redirect in my GoDaddy settings. It still hasn't updated and
If you set a permanent HTTP redirection (301 status) then will browsers still visit
Set rs = conn.Execute(Statement) //rs has 6 fields I want to add the current
I use htaccess with a set of rules to control the different pages of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.