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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:12:08+00:00 2026-05-19T03:12:08+00:00

I am trying to create some Apache rewrite rules that shall be able to

  • 0

I am trying to create some Apache rewrite rules that shall be able to route URI requests like e.g.

http://mydomain.com/articles/example to
http://mydomain.com/index.php?site=articles&page=example

What I’ve got so far is this:

RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z0-9_]+).html$ index.php?site=$1&page=$2 [L]
RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z0-9_]+)$ index.php?site=$1&page=$2 [L]

Since I am using relative file paths everywhere in my index.php, for style sheets, scripts, images and the like, I am facing the problem of incorrectly resolved absolute file paths.

For example when I am in the root, http://mydomain.com/ or http://mydomain.com/articles, all relative image paths resolve correctly – images/logo.jpg becomes http://mydomain.com/images/logo.jpg or htdocs/mydomain/images/logo.jpg respectively.

When I click one of my links on the site, e.g. http://mydomain.com/articles/example, Apache (or the Browser?) assumes all my images are located here http://mydomain.com/articles/images/ – it is pretty obvious that this path doesn’t really exist.

So here are my questions:

1. Is it possible to solve this problem without changing all my relative file paths to absolute ones?

I could use root / for all my paths on my actual web server, because my domain is advantageously linked.
mydomain.com is linked to /html/mydomain on my web server – / resolves to mydomain.com/, but on my personal computer I am running XAMPP and / resolves to htdocs/ – it should however resolve to htdocs/mydomain/ simply because I hold several sites in htdocs

Absolute file paths are terrible when updating index.php to my web server, because I have to auto-systematically replace path declarations – not only in index.php, but style sheets and scripts as well.

2. Should I create a static DNS entry on my personal computer to adapt to my web server?

3. What is the most commonly used method?

Thank you in advance!

Sincerely, Sebastian

  • 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-19T03:12:09+00:00Added an answer on May 19, 2026 at 3:12 am

    I figured it out by myself, by editing Windows’ hosts file and the Apache’s httpd-vhosts.conf file.

    1. Adding a new static DNS entry to %SystemRoot%\system32\drivers\etc\hosts

    127.0.0.1 www.mydomain.local

    2. Appending a new virtual host entry to %ApacheInstallDir%\conf\extra\httpd-vhosts.conf

    <Directory "E:\htdocs">
    Order Deny,Allow
    Allow from all
    </Directory>

    NameVirtualHost 127.0.0.1

    <VirtualHost 127.0.0.1>
    DocumentRoot "E:\htdocs"
    ServerName localhost
    </VirtualHost>

    <VirtualHost 127.0.0.1>
    DocumentRoot "E:\htdocs\mydomain"
    ServerName www.mydomain.local
    </VirtualHost>

    Now http://www.mydomain.local leads to htdocs/mydomain directly

    3. Changing all relative paths and links in my index.php by simply “rooting” them with a / in front of them, e.g. <img src="/images/logo.jpg" />

    I also managed to set up a Site in Dreamweaver, so I am able to use the Design- and the Live-View correctly.

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

Sidebar

Related Questions

I'm trying to use SlideShow to create presentation... http://poi.apache.org/apidocs/org/apache/poi/hslf/usermodel/SlideShow.html and I see some uses
What I am trying to do is to create some sort of rooms(like a
I'm trying to create a wrapper/handler that will be called on the Apache server
I'm trying to create some HtmlHelper extensions and ran into a bit of a
I'm trying to implement the WMD editor used on StackOverflow to create some basic
I'm trying to be a good developer and create some documentation before I start
Trying to create a list to return some JSON data to a view. Following
I'm trying to create a linq query based on some dynamic/optional arguments passed into
I've recently been trying to create units tests for some legacy code. I've been
I'm trying to create with Delphi a component inherited from TLabel, with some custom

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.