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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:17:00+00:00 2026-06-13T08:17:00+00:00

I expect the answer is going to be something so simple I’ll want to

  • 0

I expect the answer is going to be something so simple I’ll want to cry, but I can’t seem to figure it out. I’m new to mod_rewrite.

I wanted to change my links from things like domain.com/?p=about to domain.com/about*/* (with the trailing slash) and it works fine, but whenever I move on to a link, it appends the new link to the back of the url. For example, I have an about and a contact link. If I click about it navigates to domain.com/about/ then if I click contact, it navigates to domain.com/about/contact/ and will keep adding the links to the end of the url. If I’m at domain.com and click a link(about, in this case) it will go to domain.com/about/ and if I click about 4 more times, my address bar is going to say “domain.com/about/about/about/about/about/” I have reproduced this in a very simple example below, what am I doing wrong?

.htaccess

RewriteEngine On
RewriteRule ([a-zA-Z0-9]+)/$ index.php?p=$1

index.php

<a href="about/">about</a> | <a href="contact/">contact</a><br><br>

<?php
    if(!isset($_GET['p'])) {
        echo "home";
    } else {
        echo $_GET['p'];
    }
?>

Thank you for your help!

edit:
It works okay if I use an absolute path, but I’d rather not if I don’t absolutely have to.

edit2: adding

RewriteBase /

breaks the links. They appear to be going to domain.com/about/ and …/contact/, but I get a 404 – I’m assuming the rule I used is somehow incompatible with the way I’m doing my linking, which is why I included index.php as well.

  • 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-06-13T08:17:03+00:00Added an answer on June 13, 2026 at 8:17 am

    You are defining all of your links in HTML relative to the current path.

    You will need to change your links such that:

    <a href="about/">about</a> | <a href="contact/">contact</a><br><br>
    

    becomes (note the leading / on the urls):

    <a href="/about/">about</a> | <a href="/contact/">contact</a><br><br>
    

    When you are on a page site.com/about/us a link like <a href="home/" gets resolved by the browser to be site.com/about/us/home.

    The solution is to change all of your links, images, stylesheets, and javascripts to use absolute paths in your URLs, not relative ones like you have now.

    EDIT: Just noticed your edit. You really should use absolute paths, not relative ones. If you want to keep the relative URLs then you will have to use something like <base href="/" /> on all of your pages.

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

Sidebar

Related Questions

I've been playing around with GridBagLayout and I can't seem to figure out how
I expect the answer to this is already here someplace, but I was not
I am new to using expect, and I've searched for an answer to the
I expect this might get some downvotes / closevotes but I'm going to ask
This is a very trivial problem but I can't seem to find a way
I'm trying to figure out multi-threading programming in python. Here's the simple task with
Can I expect the keys() to remain in the same order? I plan to
I want to avoid crashes in the release even if something is wrong. That's
This seems like a very simple problem, but I cannot get a scrollbox to
This is homework, so I don't expect the answer, just a point in the

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.