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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:37:35+00:00 2026-06-14T12:37:35+00:00

I am using the following mod-rewrite in my .htaccess file: RewriteRule ^$ pages/ RewriteCond

  • 0

I am using the following mod-rewrite in my .htaccess file:

RewriteRule ^$ pages/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ pages/$1 [L]

The intention is to hide the subdirectory called /pages/ from displaying in the URL.

So this: http://mysite.com/pages/home.html

Will look like this: http://mysite.com/home.html

It works but there are some unintended consequences.

As a direct result of the .htaccess code I posted above, my 404 routing is no longer working at all. Anything that should trigger a 404 error page is instead generating a 500 Server Error.

How to fix?


EDIT:

As implied above, it does not matter if a custom 404 page is defined in the .htaccess or not. Without it, or a bad path to the error page, the server should still route to its default 404 page, and not give a 500 Server Error.

Surely, there must be a standard way to suppress sections of a URL without breaking the normal routing of 404 errors. From my online research it seems that my method above commonly breaks the 404 routing, and yet so far, I’ve seen no applicable solution. (This is not a WordPress installation; just static HTML content)


EDIT 2:

Since I’m only wanting to suppress the one directory from the URL, I never mentioned that I also have other files & directories which are siblings to /pages/ that cannot be pointed at /pages/, such as /graphics/, /includes/, /css/, /cgi-bin/, robots.txt, favicon.ico, etc.

Maybe this is all an exercise in futility or more trouble than it’s worth?

Looking for a definitive answer either way.

  • 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-14T12:37:37+00:00Added an answer on June 14, 2026 at 12:37 pm

    Following config will look for your static pages inside the pages/ and if found, it’ll display them. This shouldn’t break 404.
    Put it in root folder of your web in .htaccess

    RewriteEngine On
    RewriteCond %{DOCUMENT_ROOT}/pages/%{REQUEST_URI} -f [OR]
    RewriteCond %{DOCUMENT_ROOT}/pages/%{REQUEST_URI} -d
    RewriteRule ^(.*)$ /pages/$1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following sample plugin adds the custom mod rewrite rules to .htaccess when the
I'm using the following configuration to proxy requests and rewrite urls from Apache to
Currently we are using the following code in .htaccess to redirect users from mydomain.com
I am new to .htaccess and mod_rewrite. I am using the following rewrite rules:
I am reading javascript web application and the author is using following code: mod.load
I am using following code to show a spinning wheel: $(#loading) .hide() .ajaxStart(function(){ $(this).show();
I am using htaccess to rewrite my URL's... with codeigniter, to be specific. I
I'm rather new to the whole .htaccess thing and I'm using the following right
I'm using following chunk of instructions to rewrite www to non www url: <IfModule
I want to redirect the following url: http://abc.com/colleges/first.php to http://abc.com/first.php using mod_rewrite and .htaccess

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.