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 6319353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:47:32+00:00 2026-05-24T15:47:32+00:00

I am currently trying to do a 301 redirect for all the pages of

  • 0

I am currently trying to do a 301 redirect for all the pages of a site i am working on. The problem is that this url:

http://site.com/cash/ 
http://site.com/credit/

and

http://site.com/cash 
http://site.com/credit 

display the same pages

This will result in a number of duplicate URL issues and start splitting your PageRank of our SEO.

I was trying to do that on my site where all the seo points to the non-slash version

BTW I have about 90 pages that i have to change…any ideas on a good way of achieving this

How do i do a 301 redirect in the htaccess to do this on all my pages

Edit:

So to understand correctly. this will do the 301 redirect

# Remove the trailing slash
RewriteCond %{HTTP_HOST} ^(www.)?example\.com$ [NC]
RewriteRule ^(.+)/$ http://www.example.com/$1 [R=301,L]

But how does this exclude folder1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

and would i put that in the same htaccess file or create another htaccess file in the folder1 directory

  • 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-24T15:47:37+00:00Added an answer on May 24, 2026 at 3:47 pm

    You can add the following to your .htaccess to remove the trailing slash

    # Remove the trailing slash
    RewriteCond %{HTTP_HOST} ^(www.)?example\.com$ [NC]
    RewriteRule ^(.+)/$ http://www.example.com/$1 [R=301,L]
    

    Update

    You can then choose to also add www

    RewriteCond %{HTTP_HOST} ^example.com$
    RewriteRule (.*) http://www.example.com$1 [R=301]
    

    or remove it

    RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
    RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to apply a 301 redirect to this url /Qx%40w%2C6M42VAwp3%40Rb%7B~cC4ure%60QWI9 but it's not liking
Currently trying at add ajax to a site, after much reading I discovered that
I am currently trying to add 301 redirect to my routes in MVC to
Currently trying to come up with a best practice for a ZF site that
Currently trying to get a Bluteooth sample working. I'm using this sample as reference
I'm trying to do a 301 permanent redirect for assets.example.com/x/y/z?a=b to example.com/x/y/z?a=b unless x
I'm trying to redirect site.com w.site.com ww.site.com and wwww.site.com to www.site.com. My boss wants
Currently trying to add a slideToggle function to my website http://louislantos.com/ I want clicking
This is a really frustrating problem (bug?) that I've been trying to figure out.
I am currently trying to write some code that will accept some FTP details,

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.