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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T21:49:36+00:00 2026-06-18T21:49:36+00:00

Apache doesn’t catch the below .htaccess rule if requests are made by relative paths.

  • 0

Apache doesn’t catch the below .htaccess rule if requests are made by relative paths.

RewriteCond %{REQUEST_FILENAME} -f  [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^(.*)/?$ index.php?var=$1 [NC,L]

E.g. if the HTML sent to the client includes:

<link href="CSS/main.css" rel="stylesheet" type="text/css" />

Apache will skip the rule. If however the HTML includes:

<link href="http://host.com/CSS/main.css" rel="stylesheet" type="text/css" />

it works just fine.

The same goes for relative paths inside e.g. CSS files, like:

background-image:url(../images/image.png);

that is, if the requested CSS has first been requested with the full path name.

How is this possible?

  • 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-18T21:49:37+00:00Added an answer on June 18, 2026 at 9:49 pm

    The second RewriteRule will only rewrite the search path internally, on the server that is. So, when a relative search path is sent to the client, say:

    <link href="CSS/main.css" rel="stylesheet" type="text/css" />
    

    whatever is referred to as $1 in the second RewriteRule will be included in the search path.

    So, if e.g. http://www.example.com/en/ is requested by the client and a HTML document including the relative path href="CSS/main.css" is sent back, the client will expect the css file to be located in www.example.com/en/CSS, not www.example.com/CSS/. Naturally then if the css document in the example is referred to with a direct path like: href="http://example.com/CSS/main.css" the document will be correctly retrieved.

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

Sidebar

Related Questions

My company doesn't use Apache, so we've spun up our own socket code. In
Nginx doesn't support chunked requests so i'm tryping to proxy my PUT request to
I have Apache Velocity. I have some jQuery code. I think VM doesn't like
I have Apache 2.2.13 running in console mode on Windows. I have made an
I've read Cakes section on Apache but it doesn't cover my question. Here's my
This works on Apache, why it doesn't seem to work on IIS 7 ?
url = new java.net.URL(s) doesn't work for me. I have a string C:\apache-tomcat-6.0.29\webapps\XEPServlet\files\m1.fo and
mod_perl/apache doesn't seem able to follow symlinks. In httpd.conf I have: Options FollowSymLinks <VirtualHost
What is a good way to benchmark apache with a delay between requests from
import org.apache.http.client.*; I want to import this java package it says that it doesn't

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.