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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:03:15+00:00 2026-05-27T22:03:15+00:00

I am coding a portal which has multi categories. Example: http://localhost/portal/cats http://localhost/portal/dogs Ofcourse this

  • 0

I am coding a portal which has multi categories.

Example:

http://localhost/portal/cats

http://localhost/portal/dogs

Ofcourse this is possible with URL rewrite

Like this

RewriteRule ^cats$ /portal/index.php?cat=cats

Ok so this works alright.

Problem happens when I try to access page like this

http://localhost/portal/cats/black-cat-22

My url rewrite is:

RewriteRule ^cats/(.*)-([0-9]+)$ /portal/page.php?cat=cats&id=$2

Why?

Because all my CSS & image files are located in http://localhost/portal/elements and not in http://localhost/portal/cats/elements – which is not even real directory.

So I am looking for solution how to do rewrite if URL includes /elements/ it reads from /portal/elements not from any other directory.

If something is unclear, free to ask below.

Cheers and happy new year.

  • 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-27T22:03:16+00:00Added an answer on May 27, 2026 at 10:03 pm

    That’s where the html <base> tag comes to the rescue 🙂

    Add something like this as first line in your HTML head:

    <base href="http://localhost/portal/" > <!-- or end with /> if XHTML --> 
    

    Then everything you reference with relative URLs will be relative to that base.

    So you can reference your CSS using:

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

    Which should resolve to: http://localhost/portal/elements/stylesheet.css, no matter what URL you’re currently visiting (be that portal/cats, or portal/cats/some-black-cat etc.

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

Sidebar

Related Questions

http://coding.pressbin.com/18/Display-a-Google-Map-when-you-hover-over-location-text/ I am following this tutorial on how to display google map over a
During coding I frequently encounter this situation: I have several objects ( ConcreteType1 ,
Coding Language: C# Framework: .NET We have built a software, which among many other
I´m coding a CSS menu for Wordpress and I have this stupid problem: I
Which coding style do you prefer: object o = new object(); //string s1 =
While coding a JCL , we give SYSOUT and SYSPRINT DD s. Which type
I'm coding a web-portal for a set top box with a custom keyboard. The
For coding reasons which would horrify you (I'm too embarrassed to say), I need
This coding i got from here. I get error in log cat view like
I coding a PHP script that has to check if exists a GitHub repo

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.