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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:00:14+00:00 2026-05-17T15:00:14+00:00

I have an htaccess file which maps http://www.myserver.com/home/ to http://www.myserver.com/index.php?section=home This part works fine.

  • 0

I have an htaccess file which maps

http://www.myserver.com/home/

to

http://www.myserver.com/index.php?section=home

This part works fine. The issue I am facing now is, all my images and css reside in a sub-folder named assets, i.e.

http://www.myserver.com/assets/images/
http://www.myserver.com/assets/css/

etc.

After redirection the browser will look for the files under

http://www.myserver.com/home/assets/images/

which causes things to break, as this is not a valid path.

I have been able to add another rewrite that maps the above to the correct sub-folder, however, Firebug shows that the images are residing in:

http://www.myserver.com/home/assets/images/

I know it’s not really a problem, after all, my images and css are loading just fine with this rule.
I’m just curious as to how I could make the path shown to be the actual path, which is:

http://www.myserver.com/assets/images/

Pasting my htaccess file below. Thank you very much beforehand.

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([^/]+)/assets/(css|images|js)/(.*)$ /assets/$2/$3 [NC,L]
RewriteRule ^([^/]+)/$ /index.php?section=$1 [NC,L]
  • 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-17T15:00:14+00:00Added an answer on May 17, 2026 at 3:00 pm

    The problem is that you didn’t consider that relative URLs are resolved on the base URI that is the URI of the HTML document the reference is used in. So a relative URI path like assets/images/ in an HTML document with the URI path /home/ is resolved to /home/assets/images/ instead of /assets/images/.

    You cannot change this with mod_rewrite as URI resolution is done by the client and not by the server. The only solutions are:

    • change the base URI using the BASE element (note that this affects all relative URI);
    • using absolute URI paths, e.g. /assets/images/ instead of a relative assets/images/;
    • adjusting the relative URI path, so references in /home/ are adjusted to ../assets/images/ to reflect the path depth.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following in a .htaccess file redirect 301 /page.php http://domain.com/page Which works
I have a link which looks like that: www.domain.com/file.php I want to create .htaccess
I have the following .htaccess file which works fine for say www.companyone.com: RewriteEngine On
Currently I have a url like this http://<client_name>.website.com/index.php?function_name&cat=32 I want to set things up
I have a .htaccess file with content below which is changing my index.php?page=aboutus to
I have a .htaccess file which arranges that all requests go through index.php. Now
I have PHP source code of http://www.sitename.com . This site is located on Windows
I currently have a .htaccess file set up with this rule: RewriteRule ^([a-zA-Z0-9_-]+)$ user\.php?user=$1
I have the following htaccess file, which hides the php extension and forces all
I have a .htaccess file which right now looks like this: Options +FollowSymLinks RewriteEngine

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.