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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T02:08:16+00:00 2026-05-13T02:08:16+00:00

I have a site that I don’t think my htaccess is implementing 301 redirects

  • 0

I have a site that I don’t think my htaccess is implementing 301 redirects properly, I think my problem may be at the application level but I would appreciate it if someone can confirm the following works as I expect it to.

Example redirect: http://www.siteic.com/a/b/c/ should go to http://www.siteic.com/a/b/c – however the below doesn’t do that. NOTICE the trailing slash is removed.

Options +FollowSymLinks
RewriteEngine on
ErrorDocument 404 /

RewriteCond %{HTTP_HOST} ^siteic\.com
RewriteRule ^(.*)$ http://www.siteic.com/$1 [R=permanent,L]

RewriteCond {REQUEST_URI} ^/first/$
RewriteRule ^(.*)$ http://www.siteic.com [R=permanent,L]

RewriteCond {REQUEST_URI} ^/first$
RewriteRule ^(.*)$ http://www.siteic.com [R=permanent,L]

RewriteRule ^first/([a-z,\_%,A-Z,\_%-,0-9,\-]*)$ otherst.php?page=$1
RewriteRule ^first/([a-z,\_%,A-Z,\_%-,0-9,\-]*)/([a-z,\_%,A-Z,\_%-,0-9,\-]*)$ otherst.php?page=$1&page2=$2 
  • 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-13T02:08:16+00:00Added an answer on May 13, 2026 at 2:08 am

    I would suspect you first rule to be always true, therefore the subsequent rules are never used.

    You should use that instead:

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

    Your second rule makes sure all uri with the string ‘/first/’ redirect to the homepage.
    Your third rule does exactly the same with the string ‘/first’ so in fact you could remove your second rule, or your third one depending on your intended behaviour.

    Your fourth rule will never match because uri with “first/” will have been redirected to homepage.
    Your fifth rule should come before your fourth rule because rule 4 will be more often true than rule 5.

    As to your request: how to remove the trailing slash, i would do this:
    – first make sure the path points to a non-existent directory
    – if true, remove the slash

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

    So in the end i would do this:

    RewriteEngine on
    # force WWW in the url
    RewriteCond %{HTTP_HOST} !^www.siteic.com$
    RewriteRule ^(.*)$ http://www.siteic.com/$1 [R=301]
    
    # remove trailing slash if the url points to a non-existing folder
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)/$ /$1 [R=301,L]
    
    # redirects all url with /first to otherst.php
    ## with 2 GET vars
    RewriteRule ^first/([a-z,\_%,A-Z,\_%-,0-9,\-]*)/([a-z,\_%,A-Z,\_%-,0-9,\-]*)$ 
    otherst.php?page=$1&page2=$2
    
    ## with 1 GET var
    RewriteRule ^first/([a-z,\_%,A-Z,\_%-,0-9,\-]*)$ otherst.php?page=$1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a site that uses forms and validates fields and redirects to another
I have several strings in my site that don't belong to any app, for
I have a form that posts a file to a site that I don't
I have a site that i want to redirect all requests accept for 1
I have a site that allows download or streaming of mp3 files. All the
I have a site that can be accessed both through http (http://mysite.com) and https
I have a site that has an Rss feed, and this feed is consumed
I have a site that can allow me to access the mobile version of
I have a site that has a /sites/default/files/ directory where user content is typically
I have a site that makes use of GET variables to determine what to

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.