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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:59:41+00:00 2026-05-31T01:59:41+00:00

I’d like to setup my localhost to redirect absolute urls from a specific subdomain

  • 0

I’d like to setup my localhost to redirect absolute urls from a specific subdomain to local paths using mod_rewrite as follow:

http://resources.website.com/img/mypic.gif

would redirect to

/Users/path-to-local-website/img/mypic.gif

so my local HTML could read

<img src="http://resources.website.com/img/mypic.gif" />

and yet refer to the local image.

What would be the RewriteCond/Rule for that? Thank you

  • 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-31T01:59:42+00:00Added an answer on May 31, 2026 at 1:59 am

    So you have websites hosted somewhere in the cloud, and local replicas thereof where you do the development The HTML is the same, of course. You upload that without modifications. It contains absolute references to documents among your domains, such as images.

    When surfing the local copy of this website, you want images to come from the local copies rather than from the cloud?

    Sorry, I don’t think that is possible, at least not with mod_rewrite. Your local server is feeding your browser URL’s which point back to the cloud. When your browser processes theses URL’s, it will send the request off to the real website. You cannot rewrite a request that went to some other server!

    You would have to filter the HTML that is going out to rewrite the URL’s so that those domains point back to the local server.

    If only one domain is involved, the usual solution is not to use absolute links in the HTML, just ones relative to that web page. (For any links that don’t cross domains, you should use make them page relative.)

    A solution would be to create a local test bed environment with its own DNS server sitting on your LAN which will resolve those domain names to your local server. Your browser is thereby fooled into going to your local server for those domains.

    If your browser is on Linux or other Unix-like OS, you can simiply hack this with /etc/hosts rather than a complex DNS setup:

    # /etc/hosts on the machine where the browser and server are running
    127.0.0.1 foo.example.com bar.example.com xyzzy.example.com
    

    Now these three host names point back to the server. When your browser (running on the same machine) wants to fetch foo.example.com/img/dog.jpg it will connect to the server at 127.0.0.1.

    Configure that server with an Alias to forward the /img/ URL’s as appropriate:

    # httpd.conf
    Alias /img/ /Users/path-to-local-website/img/
    

    But now, you are only seeing the local site. Not just the images. Everything is locally referenced.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to count the length of a string with PHP. The string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.