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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:35:04+00:00 2026-06-11T22:35:04+00:00

I found this solution to redirect urls from www.domain.com/example.php to www.domain.com/example successfully but I

  • 0

I found this solution to redirect urls from www.domain.com/example.php to www.domain.com/example successfully but I cannot do the same when are few subdirs present, like with: domain.com/dir1/di2/dir3/example.php to domain.com/dir1/di2/dir3/example

How should this rule be modded in order to make the previous redirection work?

RewriteRule (.*).php$ /$1 [R=301,L]
RewriteRule (.*).html$ /$1 [R=301,L]

This is my .htaccess

ErrorDocument 404 /misc/404.html

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

RewriteRule (.*).php$ /$1 [R=301,L]
RewriteRule (.*).html$ /$1 [R=301,L]

# Forces a trailing slash to be added
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
#RewriteRule (.*)$ /$1/ [R=301,L]

Thank you!

  • 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-11T22:35:06+00:00Added an answer on June 11, 2026 at 10:35 pm

    http://demo.domain.com/en/index.php is taking me to http://demo.domain.com/index and it should take me to http://demo.domain.com/en/index

    the .htaccess is in /en/ directory

    You need to add a:

    RewriteBase /en/
    

    right below RewriteEngine on.

    You also may need to add a /en/ to the redirect rules and conditions:

    RewriteRule (.*).php$ /$1 [R=301,L]
    RewriteRule (.*).html$ /$1 [R=301,L]
    

    Needs to be:

    RewriteCond %{ENV:REDIRECT_STATUS} !200
    RewriteRule (.*).php$ /en/$1 [R=301,L]
    RewriteCond %{ENV:REDIRECT_STATUS} !200
    RewriteRule (.*).html$ /en/$1 [R=301,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to redirect http://www.example.com to http://example.com via .htaccess. I've found and tried below
The url http://www.example.com/ and http://www.example.com/index.html both display the same web page. But search engine
I found the solution for this question in C# , but I can't translate
I've been looking around for a solution to this thing but I haven't found
Edited: SOLUTION FOUND. This is strange and not the best solution, but I just
I know people asked this before and I found this solution: for (UIView *subview
I searched for an implementation of std::map runtime ordering and have found this solution:
I've search for some solution to my problem and I found this link .
I have been searching for a solution to this and so far found nothing
Edited to Add * I haven't found a solution for this one yet, can

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.