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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:48:07+00:00 2026-06-06T22:48:07+00:00

The following is my directory structures: admin\ controls\ images\ media\ lib\ models\ views\ index.php

  • 0

The following is my directory structures:

admin\
controls\
images\
media\
lib\
models\
views\
index.php
.htaccess

The following is my .htaccess

RewriteEngine On 
RewriteRule /admin/images/(.*) /images/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php

I want everything in /admin/images be equal to /images in root directory. For example: http://www.example.com/admin/images/example.png will be the same as http://www.example.com/images/example.png

Problem with my .htaccess is:
It goes to index.php instead of mirroring admin/images to images/


Solution

RewriteEngine On 
RewriteRule /admin/images/(.*) /images/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.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-06T22:48:09+00:00Added an answer on June 6, 2026 at 10:48 pm

    You need to specify that your image rewrite rule is the last one in the row in order to prevent further rewriting. For that you simply specify [L] at the end of your image rewrite rule.

    RewriteEngine On 
    RewriteRule /admin/images/(.*) /images/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php
    

    EDIT: Here is an explanation why the problem occurs (taken from the comments section in order to provide clarification).

    You see the original %{REQUEST_FILENAME} will never change no matter how many stages of rewriting are performed. That means that when the second rule is reached that variable will actually still point to the existing image (which is in /admin/images/) rather to the one being rewritten and non-existing (/images/). That’s the reason why the second rule will always be applied and why the two conditional lines from the example are almost always the first ones to be used during rewriting.

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

Sidebar

Related Questions

Assuming the following directory structure, htdocs/ images/ css/ .htaccess system/ index.php ... I would
i'm having the following directory structure: /front/index.php <- website root /admin/img/ <- extra images
I have the following directory structure in htdocs: htdocs/ .htaccess index.php foo/ bar/ priv/
Consider the following directory structure: ROOT ------ images ............... logo.png ------ includes ............... vars.php
I have the following directory structure : /script/x.js /includes/x.txt /1/2/index.html After hooking a webpage
I have the following directory structure: modules/ api/ controllers/ ApiController.php InventoryController.php OtherController.php The init()
following is my files directory structure... Config config.php (is calling some files too like
I have the following directory structure *application *media *system I place my js files
I have a following directory structure. -webshop -controllers -webshop.php In webshop.php I want to
I've got the following directory structure in tomcat 6: tomcat |-lib | |- logback-classic.jar

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.