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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:52:20+00:00 2026-06-09T20:52:20+00:00

I have a website at example.com/test/ . Lets say the website is laid out

  • 0

I have a website at example.com/test/. Lets say the website is laid out as such:

example.com
└── test/
    ├── assets/
    │   └─ stylesheet.css
    │
    ├── .htaccess
    └── index.php

index.php here is the router, as is apparently cool to do nowadays.

Whenever the user requests a page like example.com/test/stylesheet.css, I want to check to see if assets/ has that file, and if so, serve that file instead of giving the URL to index.php. Ideally, the following would work:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond assets/%{REQUEST_FILENAME} -f
RewriteRule ^(.+)$ assets/$1

But since %{REQUEST_FILENAME} is an absolute path, assets/%{REQUEST_FILENAME} turns out to be something like assets/home/public/test/stylesheet.css. %{REQUEST_URI} is no better: it turns into assets/test/stylesheet.css. I also looked at this question, but the answer didn’t work either.

Is there any way, without resorting to PHP, to do this? (If not, I’ll just use PHP’s readfile, but I don’t want to worry about LFI or anything.)

  • 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-09T20:52:21+00:00Added an answer on June 9, 2026 at 8:52 pm

    Try using the %{DOCUMENT_ROOT} and %{REQUEST_URI} vars

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}/assets/%{REQUEST_URI} -f
    RewriteRule ^(.+)$ assets/$1
    

    EDIT: I see, try this instead:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} ^/([^/]+)/(.+)$
    RewriteCond %{DOCUMENT_ROOT}/%1/assets/%2 -f
    RewriteRule ^(.*)$ /%1/assets/%2 [L,R]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 websites, lets say - example.com and example1.com example.com has a database
Let's say I have a url such as... http://www.example.com/ random-garbage-here-i-dont-want-12392 /video 2983439 Is there
I have a website(for example: test.com), which has 2 kinds of subdomains: test.com static_${version}.test.com
I have updated my website. Previously there were links like these: http://example.com/bla-bla-bla?language=de . After
I was already running a sub-website under following path http://example.com/sub-site/ Now, I have created
I have two websites: http://example.com http://example.com/sub I have a page, let's say: http://example.com/sub/page1 Is
Let's say I have a main folder in my website named test which contains
I have a website like www.example.com , I want to redirect each hit to
I have two websites, let's say they're example.com and anotherexample.net . On anotherexample.net/page.html ,
I have a website, example.com hosted at godaddy. I was just messing around with

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.