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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:59:44+00:00 2026-05-26T10:59:44+00:00

So I have errors which are passed by the url, for example index.php?error=nojs will

  • 0

So I have errors which are passed by the url, for example

index.php?error=nojs

will then be parsed by PHP to return an error message, for example: Please enable Javascript

I’m using the following line in my .htaccess to make the url easier to manage

RewriteRule ^ERROR_(.*)$ index.php/?error=$1&%{QUERY_STRING} [L]

It makes my URL look like this:
site.com/ERROR_nojs

The problem is, this only works for the root,

index.php?error=nojs        works fine however
test/index.php?error=nojs   does not?

So how can I convert the variable for every directory?

Thank you. (My original script handles hundreds of errors and filters out ones that might be useful to output to the user. It would be stupid to redirect them to the index just so they can see a small with an error message in it)

EDIT:

as Shai Mishali pointed out removing the ‘^’ before ERROR did the trick.

RewriteRule ERROR_(.*)$ index.php/?error=$1&%{QUERY_STRING} [L]

But I forgot to tell you I have another variable ?page=

I need get that vairbale and add it to the url in order for this to work..

e.g:

index.php?page=home&error=nojs
= site.com/home/ERROR_nojs

so

 www.site.com/?page=home&error=nojs   = www.site.com/home/ERROR_nojs

or

 www.site/?page=about&error=unknown  = www.site.com/about/ERROR_unknown
  • 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-26T10:59:44+00:00Added an answer on May 26, 2026 at 10:59 am

    I’m pretty sure your problem is your rule is looking for something that starts with ERROR (the ^ sign) .

    /ERROR starts with error, which works in your root , but
    /tests/ERROR starts with tests , so it won’t recognize it.

    Try removing the ^ sign and see what happens.

    Shai.

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

Sidebar

Related Questions

I have the following code, which will not work. The javascript gives no errors
I have a website which uses the custom 404 error handling in PHP/Apache to
I have this line: RewriteRule ^media/123/([a-z0-9\-]*)/$ /image.php?action=$1 Which throws up a 404 error, and
I have a javascript function for checking errors which I am calling on OnClicentClick
Good morning. I have an XML file which contains lists of warning and errors
This time I have an error which I have been trying again to figure
I have simple SSIS package in which On Error event handler I have created
Hello I have the following error by git-fsck, which cannot be cleaned by git-gc
I have some code which handles data files and reports an error when it
Hi have made this function which is made to replicate an error that I

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.