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

  • Home
  • SEARCH
  • 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 416799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:30:59+00:00 2026-05-12T18:30:59+00:00

On the one hand mod_rewrite allows me to make userfriendly urls redirecting requests to

  • 0

On the one hand mod_rewrite allows me to make userfriendly urls redirecting requests to proper script but on the other I can’t use relative links because they will point at nonexistent files.
A little example:
mod_rewrite redirects request
http://site.ru/param/one/page.html
at http://site.ru/script.php
while I have “myimg.jpeg” file at the same folder I can’t use relative link <img src="myimg.jpeg /> cause in that case the browser will try to load img from the “http://site.ru/param/one/myimg.jpeg” address.

While using mod_rewrite what is the common practice to render right path to the img/css/js files?

I have 2 ideas about the realization:
1) to add base tag like that <base href="http://site.ru/" />
2) to define a variable with the baseUrl and then use it while rendering src attributes like that:
$baseUrl = 'http://site.ru/';
...
echo '<img src="' . $baseUrl . 'myimg.jpeg" />

Which is the best solution and are there any other ways to solve the problem?

  • 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-12T18:30:59+00:00Added an answer on May 12, 2026 at 6:30 pm

    Don’t use relative URLs. In almost all cases, a $baseUrl variable is unnecessary – just reference things by their path from the site’s root.

    i.e. <img src="/images/myimg.jpeg" /> instead of <img src="images/myimg.jpeg" />

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

Sidebar

Related Questions

On one hand, a tuple is versatile, but on the other, can be less
I have a Coda slider on one webpage (hand-crafted, not using the plugin, but
On one hand, I'm told that exceptions in C# are 'expensive', but on the
For our database development we have on one hand a full schema DDL script,
On one hand it is easy to see given a key function, one can
What I know about web development I can count on one hand. In an
On the one hand if I have <script> var s = 'Hello </script>'; console.log(s);
In Ruby 1.8, there are subtle differences between proc/lambda on the one hand, and
I'm writing a 7 card poker hand evaluator as one of my pet projects.
One of the fun parts of multi-cultural programming is number formats. Americans use 10,000.50

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.