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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:53:25+00:00 2026-06-04T23:53:25+00:00

I would like to use a custom page for some HTTP error, so I

  • 0

I would like to use a custom page for some HTTP error, so I use the .htaccess file. At the same time I would like to use the URL rewriting, but that doesn’t work and I don’t know why.

This is my .htaccess :

#Rewrite options
RewriteEngine On    # Turn on the rewriting engine

#Error
RewriteRule    ^error/([0-9]{3})/?$    index.php?page=error-$1 [NC,L]

#Other options
ErrorDocument 403 error/403
ErrorDocument 404 error/404

<Files .htaccess>
order allow,deny
deny from all
</Files>

IndexIgnore *
Options All -Indexes
  • 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-04T23:53:26+00:00Added an answer on June 4, 2026 at 11:53 pm

    The argument of the ErrorDocument directive can be a string, an internal URI or an external URI. The “error/404” variant you have here is interpreted as a string, so Apache just outputs it as though it was a hard-coded error message. This isn’t what we want now.

    Now, if we prepend it with a slash, “/error/404” will be a local redirect, but local relative to the DocumentRoot. So if we have the .htaccess file at http://example.com/testit/.htaccess, and we request http://example.com/testit/something.txt, the document http://example.com/error/404 will be loaded. To avoid this, simply prepend it with the path of the subdirectory ( /testit/error/404 ), or otherwise play around with DocumentRoot. However, please be aware that it’s already a soft redirect: the browser’s address bar will show the URI the user entered, so there’s no need to make the ErrorDocument’s URI pretty. Just

    ErrorDocument 404 /path-to-my-folder/index.php?page=error-404
    

    will give a perfectly good behaviour: when we request, say, example.com/something.txt which is not found, the address bar will continue to show example.com/something.txt, while the content of index.php?page=error-404 will be served.

    But if you really want to display /error/404 in the browser’s address bar, give the ErrorDocument an absolute URI as an argument, like ErrorDocument 404 http://my-server/my-path/error/404 This will force the browser to do a hard-redirect to that document; the request will be captured by the mod_rewrite rule, and the content of index.php?page=error-404 will be served, while the address bar will continue to show /error/404. The downside of this method is that you will have to manually set the 404 response header, and you’ll have no idea what the original request was. It may also confuse robots, and will also confuse visitors, as it’s not the behaviour they expect.

    My advice is, just make it a relative link, like this:

    #Rewrite options
    RewriteEngine On    # Turn on the rewriting engine
    
    #Other options
    ErrorDocument 403 /path-to-my-subfolder/index.php?page=error-403
    ErrorDocument 404 /path-to-my-subfolder/index.php?page=error-404
    
    IndexIgnore *
    Options All -Indexes
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created some custom UITableViewCells in a nib file and would like to use
I would like to limit the use of some url's. Let's say node/add and
I would like to find a way to use custom User provider within a
I would like to use different instances of an STL custom allocator class to
I made an totally custom navigation bar and would like to use the exact
I would like to create a custom document library where I use the standard
I'd like to make an app which would use custom map (instead of Google's
i would like use a variable session ($_session) but it doesn't work in Drupal
I would like to use the Eigen matrix library as the linear algebra engine
I would like to use DocumentFragment and querySelector to make and modify DocumentFragments. 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.