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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:27:37+00:00 2026-05-28T06:27:37+00:00

Ok so i have a url like domain.com/item/item_id/item_description/page when i type the link without

  • 0

Ok so i have a url like

domain.com/item/item_id/item_description/page

when i type the link without

/page

on the url it throws a 404 error and i have to type the trailing slash on the url to make it work..

this is my htaccess code

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^item/([0-9]+)/(.*)/(.*)/?$ item.php?action=item&id=$1&desc=$2&page=$3

i have found this after searching:

# add trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*[^/]$ /$0/ [L,R=301]

which kinda solves my problem but how can i make the trailing slash to be optional by the user if the user wants to add it or not so it wont redirect everytime a slash is not found

  • 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-28T06:27:38+00:00Added an answer on May 28, 2026 at 6:27 am

    You can handle the request using one rewriterule.

    RewriteRule ^item(?:\.php)/([0-9]+)/([^/]+)?/?([^/]+)?/?$ item.php?action=item&id=$1&desc=$2&page=$3 [L]
    

    Please note I have added (?:\.php) before ^item, just to be sure this rewriterule works, if your webserver for some reason convert request

     domain.com/item/...
    

    into

     domain.com/item.php/...
    

    Tip: you can see your current rewriterule behavior enabling RewriteLog:

    RewriteLogLevel 9
    RewriteLog "/var/log/apache2/dummy-host.example.com-rewrite_log"
    

    Be careful do not use this in production.

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

Sidebar

Related Questions

I have a URL structure like this http://domain.com/page/thing1 http://domain.com/page/thing2 http://domain.com/page/thing3 I want to: remove
I have a url which has some get variables in it like: domain.com/recover?email=my@email.com&token=abc123 inside
I have url http://www.domain.com/folder/?variable=1 i would like to do a mod redirect to index.cfm
I have URL like: http://example.com#something , how do I remove #something , without causing
I have an url like this : www.domain.com/catalog/category_name/category_id/product_name/product_id example : www.domain.com/catalog/notebook/93/4_cpu_quad_core/56 and want it
I have a URL like this http://subdomain.domain.com/xyz-200_some_information I want to convert this URL to
I have this: RewriteRule ^show_shop/([0-9]+)$ show_shop.php?id=$1 [NC] When entering the url like this: domain.com/show_shop/4
I have the following page: www.domain.com/index.php?route=information/contact and I'd like to rewrite it so that
I have a URL like http://domain.com/index.php?user=test When a user logs in, I want to
I have a URL that looks like this http://domain.com/index.php/view/test . How do i rewrite

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.