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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:37:34+00:00 2026-06-17T13:37:34+00:00

I am trying to redirect following url … www.example.com/test/test2/test3/file.html to www.example.com/change/file what would be

  • 0

I am trying to redirect following url …

www.example.com/test/test2/test3/file.html 

to www.example.com/change/file
what would be the .htaccess file as i have less idea in this.

  • 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-17T13:37:35+00:00Added an answer on June 17, 2026 at 1:37 pm

    Maybe this will work:

    # Start the rewrite engine
    RewriteEngine On
    # Assume the base is root and there are no alias
    RewriteBase /
    # Prevent loops if the directory exists
    RewriteCond %{REQUEST_FILENAME} !-d
    # Make sure there is an html file in the URL and capture it's filename if so.    
    RewriteCond %{REQUEST_URI} ([^/]+)\.html/?  [NC]
    # Use only the filename as target directory.
    RewriteRule .*  %1  [L,R=301]
    

    Flags [L,R=301] mean is the last rule and it is a permanent redirection. Change to 302 if you want it to be temporal and remove the whole flag R=301 if you want a silent mapping.

    UPDATED

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ([^/]+)\.html/?  [NC]
    RewriteRule .*  change/%1  [R=301,L]
    
    # Second rule set
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ([^/]+)/?  [NC]
    RewriteRule .*  %1/%1.html  [L]
    

    Redirects permanently this

    http://www.example.com/test/test2/test3/file.html to

    http://www.example.com/change/file, with a silent map to

    http://www.example.com/change/file/file.html

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

Sidebar

Related Questions

I'm trying to do the following: I have the url: http://www.example.com/9999 and I want
i have following url structure http://www.mydomain.com/vpn-offers-p3.html this page should be redirect to http://www.mydomain.com/vpn-offers.php?st=60&page=3 here
I need help to redirect the following URL (in htaccess) http:www.domain.com/article/the-bp-oil-spill-one-year-later/19918396/20110420/ To http:www.domain.com/article/the-bp-oil-spill-one-year-later/19918396/2011/04/20/ my
I am trying to redirect: Entered URL: http://localhost/Test/Test1/key/val To the following address, but showing
I'm trying to redirect any url's that match the following criteria: old-domain.com/marketplace/businesses/anything-here/ads/ old-domain.com/marketplace/businesses/anything-here/ads/anyhting-after-this-too old-domain.com/marketplace/businesses/anything-here/ads/anyhting-after-this-too/anyhting-after-this-too/
I'm trying to redirect the URL: http://goalcandy.com/workspace/edit to the following http://goalcandy.com/?module=workspace&editgb=1 And just can't
I am trying to sign in Facebook with OAuth. I use following url: https://www.facebook.com/dialog/oauth?client_id=233884670034708&redirect_uri=http%3A%2F%2Fapps.facebook.com%2Fdemoappfbm&scope=publish_stream&response_type=token
I am trying to redirect perl system command to output file with the following
I am trying to create this redirect: Redirect /commercial%20work.html http://nataliearriolaphotography.com/fine-art-photography-prints.html The problem is that
I am trying to redirect a link like www.mywebsite.com/phpfile/uservalue/ to www.mywebsite.com/phpfile.php?param=uservalue So my .htaccess

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.