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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:27:04+00:00 2026-06-12T00:27:04+00:00

Current directory structure: wwwpublic |+ spanish(language) |– index.php |– contact.php | |- index.php |-

  • 0

Current directory structure:

wwwpublic
|+ spanish(language)
|-- index.php
|-- contact.php
|
|- index.php
|- aboutus.php
|- products.php
|- contact.php

In the root of wwwpublic directory I have files in the English language. Since site have Spanish language too, I have created separate directory named ‘spanish’. Name of pages are exactly the same in both directories.

Now, some pages in spanish directory don’t exist and I need to redirect request to such pages to root folder and retain name of file requested.

Example:
Visitor go to Spanish version, open index.php there, then he clicks on aboutus.php page (dont exists) inside spanish directory and then .htaccess redirects him to the /root/aboutus.php

  • 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-12T00:27:06+00:00Added an answer on June 12, 2026 at 12:27 am

    Try something like this in your wwwpublic directory, preferably before any routing rules you may have:

    RewriteEngine On
    
    # conditions to check that current request doesn't point to a valid resource
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    # condition to check that request is for the /spanish/ directory
    RewriteCond %{REQUEST_URI} ^/spanish/(.+)$
    
    # conditions to check if the /spanish/ is removed whether it would point to a valid resource
    RewriteCond %{DOCUMENT_ROOT}/%1 -f [OR]
    RewriteCond %{DOCUMENT_ROOT}/%1 -d
    
    # all conditions match, rewrite
    RewriteRule ^/?spanish/(.+)$ /$1 [L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following directory structure. root --src ---tests src contains the source &
I'm having some difficulties with mod_rewrite. My directory structure (part of it) is: index.php
<?php // open the current directory $dhandle = opendir('.'); // define an array to
<?php // open the current directory $dhandle = opendir('.'); // define an array to
This is an example that searches PDF files in the current directory. import os,
I would like to see my current directory structure as a tree such that
Hello I just started working with CodeIgniter framework. My current directory structure is Demo(Project
I have a directory structure that looks like this: basedir/dir1/dir2/dir3/dir4/myzip/subdirs I would like to
I am looking to copy files from a directory structure over to a new
I have directory structure: DIR |-component_name |-source |-setup.exe |-another_component_name |-source |-setup.exe |-yet_another_component_name |-source |-setup.exe

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.