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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:32:32+00:00 2026-05-28T13:32:32+00:00

I have this somewhat working though it’s important to understand the setup. With multi-domain

  • 0

I have this somewhat working though it’s important to understand the setup.

With multi-domain support (multiple domains using the exact same copy of software) I need to rewrite ONLY the directories (which end cleanly like dir1/ or dir2/).

Visually here are where the files are referenced…

site1.com/gallery/image.jpg

site2.net/gallery/image.png

gallery/ (PHP code here)

.htaccess

So I want to have only directories rewritten to gallery/ while all image files (by extension) are rewritten to the site1/gallery/image.jpg paths.

What I have currently rewrites ONLY the base gallery/ path however it does NOT rewrite deeper gallery indexes (e.g. gallery/my_gallery/) however the image exception does work as well.

RewriteEngine on
RewriteRule ^[^/]*/gallery/$ gallery/$1 [QSA]
RewriteCond %{REQUEST_URI} !\.(gif|jpg|png)$

RewriteCond %{REQUEST_URI} !.*/(gallery|admin|blog)
RewriteRule !\.(css|js)$ index.php

So how to I capture all directories regardless of depth while maintaining the image file exception please?

  • 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-05-28T13:32:33+00:00Added an answer on May 28, 2026 at 1:32 pm

    Turns out all I needed to do was add the file extensions to the rewrite condition. Also it’s VERY important to note that the rewrite condition must appear before the rewrite rule.

    RewriteEngine on
    RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|mp3|png|swf|xml)$
    RewriteRule ^[^/]*/(gallery|admin|blog)(.+) $1$2 [QSA]
    RewriteCond %{REQUEST_URI} !.*/(gallery|admin|blog)
    RewriteRule !\.(css|js)$ index.php
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to have nested set capabilities in this somewhat custom setup? Consider
I am somewhat new to R, and i have this piece of code which
This is somewhat of a follow-up to an answer here . I have a
This is somewhat of a follow-up question to this question . Suppose I have
Although somewhat related to this question , I have what I think is a
If I have an enum like this public enum Hungry { Somewhat, Very, CouldEatMySocks
I currently have a somewhat working version of what I need to be done,
Being a somewhat proficient iOS developer, I have just started working on a desktop
I have a somewhat unique situation that I can't quite get working. I've followed
I am working on redesigning a somewhat poorly designed system and have run across

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.