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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:25:15+00:00 2026-05-15T09:25:15+00:00

I have been experimenting with the lightweight NiceDog PHP routing framework, which routes like

  • 0

I have been experimenting with the lightweight NiceDog PHP routing framework, which routes like this:

R('entries/(?<id>\d+)')
  ->controller('Entries_Controller')
  ->action('show')
  ->on('GET')

Now the .htaccess file is set up to do this redirect like so:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

My problem is when I want to make a URL to somewhere, it seems impossible to do so.

Say I’ve requested the page entries/5, and on that page I would like to link to another entry entries/6:

<a href="entries/6">Next Entry</a>

This resolves to the address http://localhost/folder/to/project/entries/5/entries/6
Not what I want.

The href /entries/6 would link to http://localhost/entries/6
Also not what I want.

To work around this, I created a function to handle this problem:

function url($route) {
    return "http://localhost/folder/to/project/$route";
}

So I can now write

<a href="<?= url('entries/6') ?>">Next Entry</a>

which now links to http://localhost/folder/to/project/entries/6, which is exactly what I want.

However, I have to do this for EVERY in-site link, and it seems like there could be a better solution that doesn’t involve an externally created URL.

Is there a “better” way to fix this problem? Is this a “common” problem with PHP frameworks? (It seems it would be)

  • 1 1 Answer
  • 3 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-15T09:25:16+00:00Added an answer on May 15, 2026 at 9:25 am

    The easy alternative would be to use <base href=”http://example.org/your/project/index” /> in your page templates <head>. But that’s basically like having full URLs generated. And yes, it’s also valid for XHTML and still in HTML5.

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

Sidebar

Related Questions

I have been experimenting with a lot of web development apps like Drupal, Moodle,
I have been experimenting recently with Silverlight, RIA Services, and Entity Framework using .NET
As a php learner, I have been experimenting with some of the smaller PHP
I have been experimenting with GNU Radio and came across the tunnel.py program. This
Hello: I have been experimenting with WPF this afternoon, Im wondering does anyone know
I'm new to server-side development and have been experimenting with the Play framework recently.
I have been experimenting with woopra.com A web analytics tool. Which requires a piece
I have been experimenting with S3 and they have this cool feature where you
I have been experimenting with HTML5 and gradient fades, I would like to use
So I have been experimenting with RootsTheme (which uses Bootstrap), Wordpress (from Joomla! background)

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.