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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:18:15+00:00 2026-06-13T02:18:15+00:00

I have a site and need htaccess code to make this change in the

  • 0

I have a site and need htaccess code to make this change in the address bar without making any physical changes in the server folders

example.com/data/65767.html
to be
example.com/65767

example.com/data/56-45.html
to be
example.com/56-45

Regards

  • 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-06-13T02:18:16+00:00Added an answer on June 13, 2026 at 2:18 am

    Horribly inefficient, you need to make sure your links get changed to point to the one without .html, but…

    RewriteEngine On
    
    # externally redirect so that the browser shows the non-.html URL
    RewriteCond %{THE_REQUEST} ^(GET|POST|HEAD)\ /data/([0-9-]+)\.html
    RewriteRule ^ /%2 [L,R=301]
    
    # internally rewrite the non-.html URI back to the .html URI
    RewriteCond %{DOCUMENT_ROOT}/data%{REQUEST_URI}.html -f
    RewriteRule ^/?([0-9-]+)$ /data/$1.html [L]
    

    This works with /data/<any number of digits or "-"> URIs. If you want it to work with anything, replace the [0-9-] with .


    EDIT:

    can we also redirect example.com/65767.html to be example.com/65767 and the content from example.com/data/65767.html

    Yeah, just change the first rule to:

    RewriteCond %{THE_REQUEST} ^(GET|POST|HEAD)\ /(data/)?([0-9-]+)\.html
    RewriteRule ^ /%3 [L,R=301]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Solution with web site MyProject. I need publish this web site. In
I have web software where I need to have URLs like this http://site.com/page/var1/val1/var2//var3/val3 Then
Well i need to make it so any user can have a foo.com/username in
i need some help in this htaccess code RewriteRule ^([0-9a-z\-\_]+)?$ /index.php?url=$1 [L,QSA,NC] This code
i have a site site.com/?w=thisworks site.com/w/thisalsoworksmanually i got this to work via htaccess now
I have a Drupal 7 site and need to output a small calendar control
I have a site using CF8 and Fusebox 5. Anytime I need to add
I need to check if the images people upload to my site have the
Afternoon All, I have a web site where i need to know who is
I currently have a web site hitting 7 Access DBs that I desperately need

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.