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

  • Home
  • SEARCH
  • 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 3855226
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:44:36+00:00 2026-05-19T17:44:36+00:00

I posted up a question about an hour ago asking a regex question about

  • 0

I posted up a question about an hour ago asking a regex question about trailing slashes

(http://stackoverflow.com/questions/4907130/url-regex-remove-trailing-slash-from-file-name-and-end-of-url)

And a very helpful person gave me this to redirect pages with a trailing slash to a page with none.

However I have just noticed that it causes an infinite (never ending loop) of redirects if you try and access a folder, as you go to say http://example.com/images the server (Apache) adds a trailing slash as its a directory, then the Regex removes the slash, redirects back to the http://example.com/images URL which then gets its slash added back on by Apache etc etc :/

Any Ideas as to how to modify the rule below to prevent this?

 RewriteRule ^(.*)/$    $1  [R=301]

Many thanks, help always appreciated! 🙂

  • 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-19T17:44:37+00:00Added an answer on May 19, 2026 at 5:44 pm

    Added in the line below just above my current RewriteRule ^(.*)/$ $1 [R=301] rule

    RewriteCond %{REQUEST_FILENAME} !-d
    

    Thanks for the reply though limc 🙂

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

Sidebar

Related Questions

Somebody has posted an hour ago or so a question that was about the
Some time ago I posted a question about what questions should a good javascript
A little over a year ago I posted a question about splitting a build
Not long ago I posted a question about a design decision of my F1
Last Updated: 2009-08-11 2:30pm EDT A few days ago I posted this question about
I posted this question about 15 minutes ago and I got some good responses.
I just posted this question link text about 5 minutes ago and I forgot
I recently posted a question about Azure... is it really an OS? I understand
I just posted a question about whether WPF is a good choice for a
I have posted a question about multilanguage database design here, [] What are best

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.